Repository navigation
Conversation
compute_noise_predcompute_noise_pred
…se_pred` A DiT with one output head per denoising step (MiniMax-H3-Image's PDD heads) cannot choose the head from the timestep input alone. The rollout already records which step a train pair came from, so the pair now carries it as `denoising_step_index`, the Flow-GRPO prepare hook batches it into `PreparedBatch.denoising_step_indices`, and the actor hands it to the family's forward. A loss that samples its own noise levels leaves it None. The existing families ignore it.
…p index A custom expander that emits the step as a Python int, as the DMD2 one does for its own key, failed in torch.stack.
Nothing called prepare_flow_grpo_batch, so dropping the field or stacking another one kept every test green.
… set it DMD2's generator hook also trains on its rollout's step and leaves the field None, so the None rule is which hook sets it, not whether the loss samples its own noise levels.
The prepare hook accepts an int or a tensor scalar, and only the tensor was exercised.
zhihengy
force-pushed
the
fsdp/denoising-step-index-to-forward
branch
from
November 18, 2026 06:30
92ac429 to
ce2e7da
Compare
`test_prepared_batch_carries_each_pairs_rollout_step` runs the real expander on two windowed trajectories and checks the steps after the prepare hook, so the test that read the same key off one pair could not fail alone. The file's estimate goes to 20 s: the prepare test imports the loss hub, which takes about 9 s.
The built-in prepare hook read `denoising_step_index` off every pair, so a custom expander written before the key existed failed with a KeyError on every family, though only a family whose forward depends on the step reads it. Pairs without the key now prepare with `denoising_step_indices=None`, which such a family rejects by name; a micro-batch with the key on only some pairs is an error, and so is a step that is not an integer.
…amily must do "A family whose forward needs it rejects a batch without it" read as something the framework does; it is the family's job. The field's comment and the forward's docstring no longer list which built-in hooks set it, which the user guide says once.
A float step raised operator.index's bare TypeError, and no test pinned that it raises at all: with int() a step of 2.7 would run the pair through step 2's head.
…ent family needs it on every pair
…atch field The base forward's docstring and the stacking helper's repeated the field comment, and the operator.index comment repeated the error below it.
…e each The every-pair-or-none and integer rules are the prepare hook's error messages; the guide keeps what the default expander sets and where the prepared field goes.
This branch has not been deployed
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.
[H3-Image 1/4] MiniMax-H3-Image's DiT has one output head per denoising step: the family's forward has to know which step a train pair came from, and today it receives only the timestep. No behaviour change for the existing families.
Stack:
main<- #393 (step index) <- #394 (loader) <- #395 (family) <- #400 (recipe and model page) and #410 (full-weight training), both on #395. #392 (diffusers 0.43.0) has merged, so the stack runs in the default CI image.What
data_conversion_hub/flow_grpo.py: every Flow-GRPO train pair carriesdenoising_step_index, its step number in the rollout's schedule.prepare_flow_grpo_batchbatches it into the newPreparedBatch.denoising_step_indices([B]long, 0-based). Of the built-in prepare hooks only this one sets it; the others leave itNone, and so does this one when no pair carries the key. The key on only some pairs of a micro-batch is an error.FSDPTrainRayActor._forward_train_pair_batchpasses it toTrainPipelineConfig.compute_noise_predas a new keyword argument. The base forward and the four overrides (Cosmos3, H3, LTX, Qwen-Image 2.1) accept it and do not read it.PreparedBatch.denoising_step_indicesand the pair key incustomization.md.Why
sde_step_indices, pluslatent_step_indiceswhen the engine returns a window), so the trainer receives it instead of matching the timestep against a release's sigma grid.[A4]timesteps_inputor the cond dict:timesteps_inputis keyed by latent stream, and the step is per row.[A5][A8]Behaviour ledger
TrainPipelineConfigsubclass that overridescompute_noise_predmust acceptdenoising_step_indices, and a hook that callscompute_noise_preditself must pass it (it has no default), elseTypeError.--custom-expand-samples-to-train-pairs-path, or a--custom-convert-samples-to-train-data-pathoverride, that feeds the built-in Flow-GRPO prepare does not have to emitdenoising_step_index. Without it the prepared field isNone, which only a family whose forward needs the step rejects. One that emits it sets an int or an integer tensor scalar on every pair of a micro-batch; any other value is aValueErrorthat names the pair key.Validation
CPU, on this box, CI-recipe environment with diffusers 0.43.0, head 9579187:
test_traj_window_convert.py::test_prepared_batch_carries_each_pairs_rollout_stepprepare_flow_grpo_batch, two samples with windows[2, 3]and[6, 7]in one micro-batch give[2, 3, 6, 7], long, with one pair carrying a plain int. It fails when the prepare hook drops the field or stacks the position in the window...::test_pairs_without_a_step_prepare_without_step_indices,...::test_a_micro_batch_with_the_step_on_only_some_pairs_is_rejectedNone; the key on some pairs only raises...::test_a_step_that_is_not_an_integer_is_rejectedint()in place ofoperator.indexa step of 2.7 would run the pair through step 2's headtest_reference_models.py::test_the_family_forward_receives_the_prepared_denoising_stepstests/ci/run_suite.py --hw cpu --suite stage-a-cpuat the stack's two tops, which contain this headpre-commit run --all-filesNot executed: the GPU suites and the e2e. No e2e standard is expected to move, since no existing family reads the argument.
Follow-ups
step_index, and leavesdenoising_step_indicesunset. Nothing reads it there today ([H3-Image 3/4] feat(h3-image): add the MiniMax H3 Image train family for t2i Flow-GRPO with LoRA #395 accepts onlypolicy_loss). Setting it, and giving the two pair keys one name, belongs with the first family that needs the step under DMD2.