refactor(diffusion): move rollout patch group selection to a CLI arg - #97
Merged
Merged
Conversation
Rockdu
marked this pull request as ready for review
August 6, 2026 22:40
Rockdu
force-pushed
the
tpc-decouple-flying-wires
branch
2 times, most recently
from
August 8, 2026 21:38
d766c6f to
985fd5b
Compare
Rockdu
force-pushed
the
tpc-decouple-flying-wires
branch
from
August 8, 2026 21:48
985fd5b to
39cc33e
Compare
2 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.
What
TrainPipelineConfig.rollout_patch_group: family config classes no longer inject rollout monkey-patch groups behind the user's back.--rollout-patch-group(comma-separated) as the single way to select patch groups at launch; it also replaces--apply-sgld-monkey-patches(now--rollout-patch-group sgld). The LTX launch script passes--rollout-patch-group ltx.@register_rollout_patch_groupregistry inmiles_validate_args, so an unknown group fails at arg validation instead of inside the sglang-d scheduler child at engine startup.Why
rollout_patch_groupwas the last direct config→rollout coupling: a train-side config class decided which monkey patches the inference engine applies, with the knowledge crossing two processes (train arg validation →MILES_ROLLOUT_PATCH_GROUPSenv → sglang-d scheduler) and no validation until deep inside the engine. Selecting patch groups in launch arguments keeps arg validation to validation only (no inference from config classes) and makes the rollout-parity patching visible in the launch command. Behavior is unchanged for the in-tree recipes: the LTX and flowgrpo-aligned scripts pass the flag explicitly.--apply-sgld-monkey-patchesis removed (breaking for out-of-tree launch commands): keeping two selection mechanisms for the same registry would leave the old implicit path alive.Files
miles/utils/arguments.py— add--rollout-patch-group, resolve it intoargs.rollout_patch_groups, validate groups against the registry; drop thecfg_cls.rollout_patch_groupinjection and--apply-sgld-monkey-patchesmiles/backends/sglang_diffusion_utils/monkey_patches/__init__.py— addvalidate_rollout_patch_groups(); reuse it inapply_env_selected_rollout_patchesmiles/backends/fsdp_utils/configs/train_pipeline_config.py— remove therollout_patch_groupfieldmiles/backends/fsdp_utils/configs/ltx.py— droprollout_patch_group = "ltx"scripts/run-diffusion-grpo-ltx23-sglang.sh,scripts/run-diffusion-grpo-pickscore-5gpu-flowgrpo-aligned.sh— pass--rollout-patch-group ltx/sgldtests/fast/backends/sglang_diffusion_utils/test_rollout_patch_groups.py— cover the validator (registered instage-a-cpu)Checklist
pre-commit run --all-filespassespytest -xis green —tests/fast: 147 passed;test_hybrid_shard_mesh/test_metric_buffer_distfail identically on cleanmainin this sandbox (no local torch.distributed rendezvous), unrelated to this changepython3 train_diffusion.py --helpstill parses (new flag renders; run with a stubbed sglang, CPU-only env)