| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat(flux2): add regional prompting for FLUX.2 Klein (#9255) * feat(flux2): add regional prompting for FLUX.2 Klein FLUX.2 Klein's diffusers transformer already accepts an attention mask through joint_attention_kwargs, and its unified attention sequence [txt, img] matches FLUX 1, so regional prompting works without a forward override — we just build a restricted mask and pass it down. Backend: - Flux2RegionalPromptingExtension builds a restricted [txt, img] mask from per-conditioning Qwen3 embeddings + image masks (FLUX 1 logic, no CLIP pooled). Unlike FLUX 1 the same mask is applied to every block (no per-block alternation, since we use the diffusers forward). - flux2 denoise() threads pos_joint_attention_kwargs to all positive transformer forwards; negative passes stay unmasked. - flux2_denoise invocation accepts list[FluxConditioningField] and skips masking when reference images extend the image stream. Frontend: - buildFLUXGraph wires posCondCollect + addRegions for the FLUX.2 path. - addRegions clones flux2_klein_text_encoder edges (qwen3_encoder, max_seq_len, mask) for each regional prompt. - validators surface unsupported features (regional negative, auto-neg, reference images) so FLUX.2 regions are filtered consistently with FLUX 1. - schema.ts regenerated to reflect the list-or-single union. * Chore OpenApi + typegen * Chore Typegen * fix(flux2): review fixes for regional prompting - Update flux2 denoise tests for the new conditioning API: mock conditioning fields need mask=None, and the dummy transformer must accept joint_attention_kwargs - Bump flux2_denoise invocation version to 1.6.0 for the positive_text_conditioning type change (regenerated openapi.json) - Log a warning when regional masks are dropped because reference images extend the image token stream - Add defensive asserts in addRegions for the FLUX.2 negative-prompt and auto-negative branches (unreachable today via validators) - Add unit tests for Flux2RegionalPromptingExtension mask construction Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> | 1 个月前 | |
fix(flux2): stop the sampler from advancing reference image tokens (#9510) Reference image latents were concatenated onto the sampled tensor once before the denoising loop, and the model prediction was never sliced back to the generated tokens. Every sampler step therefore integrated the reference tokens along the model's velocity field, so the reference drifted away from the encoded image over the schedule and dragged the generated image with it - reported as a reproducible ~20% spatial shift of the edited result, independent of the prompt. Build the model input per forward pass instead and slice both the positive and the negative prediction to the generated sequence length, matching the FLUX.1 Kontext path and diffusers' Flux2KleinPipeline. The latents that the sampler advances now contain only generated tokens, which also removes the split/recombine dances around the inpaint merge and the step previews. Adds a regression test that asserts the reference part of the model input is bit-identical to the encoded latents at every step, across both the scheduler and the manual Euler path, with and without CFG. Co-authored-by: Jonathan <34005131+JPPhoto@users.noreply.github.com> | 27 天前 | |
feat(flux2): add regional prompting for FLUX.2 Klein (#9255) * feat(flux2): add regional prompting for FLUX.2 Klein FLUX.2 Klein's diffusers transformer already accepts an attention mask through joint_attention_kwargs, and its unified attention sequence [txt, img] matches FLUX 1, so regional prompting works without a forward override — we just build a restricted mask and pass it down. Backend: - Flux2RegionalPromptingExtension builds a restricted [txt, img] mask from per-conditioning Qwen3 embeddings + image masks (FLUX 1 logic, no CLIP pooled). Unlike FLUX 1 the same mask is applied to every block (no per-block alternation, since we use the diffusers forward). - flux2 denoise() threads pos_joint_attention_kwargs to all positive transformer forwards; negative passes stay unmasked. - flux2_denoise invocation accepts list[FluxConditioningField] and skips masking when reference images extend the image stream. Frontend: - buildFLUXGraph wires posCondCollect + addRegions for the FLUX.2 path. - addRegions clones flux2_klein_text_encoder edges (qwen3_encoder, max_seq_len, mask) for each regional prompt. - validators surface unsupported features (regional negative, auto-neg, reference images) so FLUX.2 regions are filtered consistently with FLUX 1. - schema.ts regenerated to reflect the list-or-single union. * Chore OpenApi + typegen * Chore Typegen * fix(flux2): review fixes for regional prompting - Update flux2 denoise tests for the new conditioning API: mock conditioning fields need mask=None, and the dummy transformer must accept joint_attention_kwargs - Bump flux2_denoise invocation version to 1.6.0 for the positive_text_conditioning type change (regenerated openapi.json) - Log a warning when regional masks are dropped because reference images extend the image token stream - Add defensive asserts in addRegions for the FLUX.2 negative-prompt and auto-negative branches (unreachable today via validators) - Add unit tests for Flux2RegionalPromptingExtension mask construction Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> | 1 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 27 天前 | ||
| 1 个月前 |