Repository navigation
Conversation
zhihengy
added this pull request to stack #336
October 21, 2026 06:08
This was referenced Oct 21, 2026
Open
zhihengy
marked this pull request as ready for review
October 21, 2026 20:53
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.
First of a stacked series that adds DMD2 distillation. Gives each trainer its own args: a trainer config list names the run's trainers and what each one overrides, and
compute_trainer_argsbuilds that trainer's args from it. Every run still has exactly one trainer, the actor, with no overrides, so nothing changes.What
miles/utils/trainer_config.py:TrainerConfig(role, overrides);compute_trainer_configs(args)lists the run's trainers. For now it returns only the actor, without overrides;compute_trainer_args(args, trainer)deep-copiesargsand applies the trainer's overrides. Overriding an argument the parser doesn't know is rejected.create_training_modelsinitializes the actor group withcompute_trainer_args(args, actor_config)instead ofargs. The copy holds the same values, so the trainer sees the same arguments.Why
DMD2's critic runs as a second trainer group on the same
FSDPTrainRayActorclass, and that class reads the plain argument names (hf_checkpoint,lr,load/save,num_steps_per_rollout, the hook paths). One Namespace can't hold the actor's and the critic's values at once, so each trainer gets its own copy of the args with its overrides, and the trainer class stays role-agnostic. The per-trainer choices live in a config module next toeval_config.py, which already resolves per-dataset overrides, rather than in the Ray placement code.Upstream precedent: miles keeps the trainer list (
MegatronTrainerConfig(trainer_id, model_id, role, overrides), with the critic synthesized from--use-critic) andcompute_trainer_args(args, trainer)(a deep copy whose overrides must be known arguments) inmiles/backends/megatron_utils/megatron_config.py. Itsplacement_group.pyonly calls them.Tests
tests/fast/utils/test_trainer_config.py:test_sft_encoder_argsparser fixture).Checklist
pre-commithooks (black, isort, ruff at the pinned versions) pass on the changed filespytest tests/fastis green (513 passed, 6 skipped; 510 on main)python3 train_diffusion.py --helpstill parses (no flags changed)Stack
DMD2: distill a flow-matching teacher into a few-step student with distribution matching. The critic (fake score) and the frozen teacher live in their own colocated trainer group; the actor holds only the student. Merge in order:
external_data--loss-type dmd2on the actor