Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
29b34bc to
b0ed761
Compare
726ee60 to
087964f
Compare
This comment has been minimized.
This comment has been minimized.
…returned pre-connector embeddings Qwen-Image 2.1 raised KeyError: 'qwen21_negative' for the same request. Declared: Wan, Qwen-Image, SD3, FLUX.2 and Krea2, whose negative cond comes only from stages that read Req.needs_negative_cond.
…e codebase already uses
… worded it differently
…on: the old case passed with the gate reverted
…thout reading needs_neg_cond
…lways carries the unconditional text ids
|
Required checks failed on 67ac9bd; this PR cannot be merged until they pass. PR title (run)
|
Motivation
DMD2 distillation in miles-diffusion (radixark/miles_diffusion#333) scores the student's samples with the teacher under CFG, inside the trainer. The trainer has no text encoders, so it replays the cond that the rollout returns in
denoising_env. The student samples unguided (guidance 1), and then the engine never encodes the negative prompt:neg_cond_kwargscomes back empty and the teacher can't run CFG.Modifications
RolloutRequest/SamplingParams: newrollout_return_neg_cond_kwargs, defaultFalse(no behavior change).Req.needs_negative_condis true under CFG or for a rollout that sets the field. The stages that produce the negative cond read it instead ofdo_classifier_free_guidance:TextEncodingStageencodes, appends and checks the negative prompt. Its dedup fingerprint uses the same flag, so a grouped request without the field never hands its empty negative cond to one with it.SD3ConditioningStagemerges the negative embeddings.DenoisingStagebuildsneg_cond_kwargs, which the rollout hook already copies intodenoising_env.do_classifier_free_guidance.CFGPolicy.buildadds the unconditional branch only under CFG, so such a request still runs one DiT forward per step.The flag is independent of #45230, and the two branches merge without conflicts.
Accuracy Tests
FLUX.2-klein-base-4B, 1×B200, 512², 4 steps,
cps/ noise level 1.0, negative prompt"blurry, low quality", same seed for every request:neg_cond_kwargsindenoising_envNone(the gap)rollout_return_neg_cond_kwargspos_cond_kwargs, trajectory latents and per-step model outputs bitwise equal; 4 DiT forwardsSpeed Tests and Profiling
Same setup, median of 6 requests after warmup:
inference_time_s)rollout_return_neg_cond_kwargsAfter the first request the negative embedding comes from the conditioning cache, so the extra cost is the negative cond in the response.
Checklist
pre-commithooks (isort 7.0.0, ruff 0.15.1) are clean on the changed files.test_text_encoding_cache.py: a request with the field gets the negative cond without CFG, also when it is grouped with one without the field. The test fails if the dedup fingerprint ignores the field.test_cfg_gating.py: a negative cond without CFG keeps one branch.test_rollout_api.py: the field is forwarded to the sampling params.test_ideogram4.pyfp8 text encoder: global server args not set) also fail onsglang-miles203f4bb.CI States
Latest PR Test (Base):⚠️ Run #45276878526⚠️ Run #45276879136⚠️ Run #45276879784
Latest PR Test (Extra):
Latest PR Test (AMD ROCm 10):
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: