Repository navigation
Add Qwen-Image 2.1 family support and a 1-GPU PickScore Flow-GRPO recipe - #256
Merged
Merged
Conversation
Register the single-stream T2I family so FSDP can load the 2.1 DiT, rebuild joint img_mask/img_shapes, and slice the image tail of the noise prediction.
Disable 2.1 fused kernels, wipe prefix KV before every denoise step, and reuse the PEFT-ordered LoRA add so IPC-synced adapters match the trainer.
Colocate train, sglang, and PickScore for a wiring and log_prob_diff check at 512^2. 2.1 checkouts are prepended only when SGLANG_21_PYTHON or DIFFUSERS_21_SRC is set.
Scale the 1.0 flow_grpo window to one GPU: 8x8 samples, lr 3e-4, 400 rollouts. Keep CFG at 1.0 because 2.1 is distilled.
After the 8x8 long run collapsed, use 16x16 samples and lr 1e-4 so each update sees a larger group with less noisy steps.
Point the model list and CLI help at family key qwen_image21, and note that HF ids still matching qwen-image need an explicit family flag.
niehen6174
requested review from
Rockdu,
guapisolo and
zhihengy
as code owners
September 21, 2026 03:21
Rockdu
reviewed
Sep 22, 2026
Qwen-Image-2.1 contains the 1.0 substring qwen-image, so first-match resolution selected the wrong family.
Qwen/Qwen-Image-2.1 now resolves to qwen_image21 without an explicit family flag.
That pad only kept Qwen-Image 1.0 bitwise with the pre-refactor whole-window collate.
Record the 200-rollout reward curve and the train/rollout log-prob gap.
The index names the recipe, not the topology it was first run on.
OnePunchMonk
pushed a commit
to OnePunchMonk/miles_diffusion
that referenced
this pull request
Oct 5, 2026
6 tasks
# Conflicts: # docs/user-guide/cli-reference.md # docs/user-guide/customization.md # docs/user-guide/recipe-verification.md
…t and task check Signed-off-by: rockdu <kangrdu@gmail.com>
…uts out of the rollout env Signed-off-by: rockdu <kangrdu@gmail.com>
…ollate branches Signed-off-by: rockdu <kangrdu@gmail.com>
…vars and full trajectory Signed-off-by: rockdu <kangrdu@gmail.com>
…uplicate timestep case Signed-off-by: rockdu <kangrdu@gmail.com>
…-miles and diffusers 0.41 Signed-off-by: rockdu <kangrdu@gmail.com>
Rockdu
force-pushed
the
feat/qwen-image-21
branch
from
October 18, 2026 23:46
d744d21 to
dd19550
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
qwen_image21as a separate train/rollout family from Qwen-Image 1.0, plus one official 1-GPU T2I recipe: Flow-GRPO + PickScore.2.1 is Qwen3-VL conditioning, single-stream block-causal DiT, RGBA VAE, and CFG-distilled (default guidance 1.0). This PR only covers the T2I path. I2I is served by the engine but has no recipe yet.
Qwen-Image 2.1 support is already on sglang main and diffusers main (landed via sglang
#39983and diffusers#14804). This PR does not pin those packages to a released version yet; until miles-diffusion's default deps include them, pointSGLANG_21_PYTHON/DIFFUSERS_21_SRCat current main checkouts.What's included
Train config (
qwen_image21)t / 1000)img_mask/img_shapesfrom--diffusion-height/width[:, -target_tokens:])to_q/k/v,to_out.0,img_mlp.{proj,out,gate_layer}Rollout patch group
qwen_image21Recipe
scripts/run_diffusion_grpo_qwenimage21_pickscore_1gpu_v2.py1e-4, 200 rollouts--rollout-return-full-trajectoryso SDE-window conversion can index a full 0..T latent arrayDocs / tests
docs/models/qwen-image/qwen-image-21.mdHow to run
Recipes must pass
--diffusion-model-family qwen_image21. A bareqwen-imagesubstring (includingQwen/Qwen-Image-2.1) still resolves to the 1.0 family.If the installed sglang / diffusers are not yet new enough, set
SGLANG_21_PYTHONandDIFFUSERS_21_SRCat current main checkouts. Real-weight GRPO needs ≥80GB; 32GB only finished generate.Results
PickScore
reward_meanlog_prob_mean_abs_diffOut of scope / follow-ups
SGLANG_21_PYTHON/DIFFUSERS_21_SRClatent_step_indices— this PR uses--rollout-return-full-trajectoryinsteadlog_prob_mean_abs_diff ≈ 5e-5)Test plan
qwen_image21config / registry / FSDP plan / patch grouplog_prob_mean_abs_diff~5e-5