Repository navigation
[DMD2 8/10] perf(ray): sleep each trainer group right after its train - #342
Merged
Merged
Conversation
This was referenced Oct 26, 2026
Merged
Merged
6 tasks done
Rockdu
force-pushed
the
dmd2/05b-sleep-after-train
branch
from
November 4, 2026 19:41
f5aa744 to
cfd5368
Compare
zhihengy
force-pushed
the
dmd2/05b-sleep-after-train
branch
2 times, most recently
from
November 10, 2026 03:59
e804eea to
41b4957
Compare
zhihengy
force-pushed
the
dmd2/05b-sleep-after-train
branch
from
November 10, 2026 11:44
41b4957 to
2d35bc1
Compare
zhihengy
marked this pull request as ready for review
November 10, 2026 13:19
zhihengy
force-pushed
the
dmd2/05b-sleep-after-train
branch
from
November 11, 2026 08:18
2d35bc1 to
55a681e
Compare
Rockdu
force-pushed
the
dmd2/05b-sleep-after-train
branch
4 times, most recently
from
November 11, 2026 15:44
26ceca3 to
c4769e2
Compare
Rockdu
force-pushed
the
dmd2/05b-sleep-after-train
branch
from
November 11, 2026 15:44
c4769e2 to
9470b60
Compare
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.
Eighth of the DMD2 stacked series, on top of #334. With
--offload-train, the sync driver now puts each trainer group to sleep right after its train, before the next group wakes, instead of keeping every group on the GPUs until all of them have trained. A DMD2 critic group no longer holds the critic, its optimizer and the teacher on the GPUs while the actor trains.What
train_diffusion.py: per rollout, each group trains, saves (on save rollouts) and then sleeps (--offload-train) or clears its memory, in declared order. Thesaveandoffload_trainhelpers stay, now taking the group; the rollout manager's save runs once after the loop, as before.external_data.Why
train.pyoffloads the critic right aftercritic_model.train(...)and beforeactor_model.train(..., external_data=values), under--offload-train. Upstream saves after both trains and wakes each model to save it (save_training_model: onload, save, offload). Here each group saves before it sleeps instead, which avoids that extra wake on save rollouts and keeps the single-group order as it was.Tests
tests/fast/test_train_diffusion.pyruns the production driver loop with fake groups, for one and two groups, with and without--offload-train: each group trains, saves and sleeps (or, without--offload-train, clears its memory) before the next group starts. Both two-group cases fail on [DMD2 7/10] feat(dmd2): train the student with the distribution matching gradient from the critic group's scores #334; the single-group cases pass on both.Checklist
pre-commithooks (black, isort, ruff at the pinned versions) pass on the changed filespytest tests/fast: 562 passed, 7 skipped; 4 tests fail in this environment and fail the same way on [DMD2 7/10] feat(dmd2): train the student with the distribution matching gradient from the critic group's scores #334 (test_hybrid_shard_mesh::test_mesh_axesandtest_metric_buffer_dist::test_metric_buffer_reduction, whose torchrun children import another checkout, and twotest_sft_h3_ref2va_encodercases)python3 train_diffusion.py --helpstill parses (no flags changed)Stack
DMD2: distill a flow-matching teacher into a few-step student with distribution matching. Merge in order:
external_data--loss-type dmd2on the actorA GAN head and other follow-ups come after this series.