feat: add MiniMax H3 t2va Flow-GRPO support - #154
Open
niehen6174 wants to merge 8 commits into
Open
Conversation
prepare_flow_grpo_batch read scheduler.config.num_train_timesteps up front, but only multi-DiT families use it — to decide which component a timestep belongs to — and only their schedulers are guaranteed to declare it. A single-DiT family whose scheduler config omits the field (MiniMax H3's carries just shift) died on a FrozenDict AttributeError before reaching the branch that needs it.
…ackend _component_class required model_index.json to describe a component as exactly [library, class_name]. Modular pipelines append a third loading-spec element, so every component of one resolved to None and load_component raised "cannot resolve the class". Only the first two elements carry meaning in either format.
_compute_server_args reads args.sglang_tp_size, which the hand-built Namespace never set, so test_lora_ipc_uses_resolved_args failed on an AttributeError rather than on anything it meant to assert.
Trains H3 with LoRA against an sglang-diffusion rollout: 1344x768 / 107-frame
t2va video, flow-SDE dynamics, PickScore reward. A 2-GPU verification run holds
log_prob_mean_abs_diff at 4e-5..9e-5, i.e. the train-side scorer reproduces the
sampler's own log probs.
Three family hooks on TrainPipelineConfig carry what cannot be generic, so no
call site needs to know a family name:
* apply_rollout_sampling_params — H3's sgl-d request takes a target of
{short_edge, aspect_ratio, duration_seconds} and rejects the generic
width/height/num_frames/fps and CFG fields, which it drops here. The pixel
canvas is an output of sglang's shape policy, not an input, so the two
cannot be mapped onto each other: 16:9 resolves to 1344x768, itself 7:4.
* sde_step_backend_overrides — picks H3SdeStepBackend per --diffusion-sde-type.
* lora_layer_group_collector_path — LoRA IPC is the only weight-sync path that
can reach H3's rollout DiT, which renames modules and fuses Q/K/V, so the
family rejects every other mode instead of silently training nothing.
H3SdeStepBackend inherits the generic flow-SDE kernel and only resolves sigma
differently (linearly from the rollout timesteps, since H3's scheduler is never
given a sigma grid). It rejects sigma=1 rather than propagating the NaNs the
1/(1-sigma) factor produces there, which is why the recipe's SDE window starts
at step 1.
diffusers is pinned to a main commit: H3's model code is merged there but ships
in no release yet.
Resolve SKILL.md in favor of upstream's install-skill rewrite (radixark#146). The H3 diffusers pin stays documented in requirements.txt. Also drop the recipe's --diffusion-model flag, which radixark#142 folded into --hf-checkpoint.
niehen6174
requested review from
Rockdu,
guapisolo and
zhihengy
as code owners
August 11, 2026 13:20
Keep both H3 and Cosmos3 CondKwargs fields. Delete the wandb sglang_enable_metrics forward: the CLI flag is gone, so the branch never ran.
6 tasks
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
diffusersto the main commit that merged H3 (not in a release yet).scripts/run_diffusion_grpo_h3_t2va_2gpu.py.num_train_timesteps, LoRA test fixturesglang_tp_size.H3-specific bits (sampling target, SDE scorer, LoRA name/layout map) go through
TrainPipelineConfighooks instead ofif family == "h3"in generic code.Dependencies
requirements.txt(git pinf53d5520). Force-reinstall if pip keeps an older wheel:MiniMaxAI/MiniMax-H3, datasetrockdu/miles-diffusion-datasets(flowgrpo_pickscore; auto-downloaded by the recipe).Reproduce
We only had 2 GPUs, so the long run used
rollout_batch_size=4,n_samples_per_prompt=16. That is enough to train, but the GRPO group is smaller than we would like.rollout_batch_size=8/ group 16 is the better recipe when more GPUs are available (e.g. 8).On 2 GPUs, expect
log_prob_mean_abs_diffaround1e-5 .. 8e-5, and LoRA IPC withskipped 0.Notes:
1,4(skip step 0 from the recipe: σ=1 is singular for H3 flow-SDE). The train-side scorer is the generic flow-SDE backend.--use-lora --lora-ipc-weight-sync.aspect_ratio+duration_seconds(notwidth/height); sglang fixesshort_edge=768.Results
log_prob_diff stays in
1.4e-5 .. 7.1e-5(well under1e-4), so the train-side scorer matches the rollout log-probs at this scale:Eval PickScore (every 10 rollouts) moves 0.806 → 0.814, peak 0.816 at step 59. The lift is small; this is the batch-4 curve, not the recommended batch-8 recipe:
Train rollout reward is noisier (64 samples / step) and sits around ~0.79 raw PickScore:
Test plan
log_prob_mean_abs_diff < 1e-4