Repository navigation
Conversation
This was referenced Oct 19, 2026
zhihengy
marked this pull request as ready for review
October 19, 2026 22:13
This was referenced Oct 19, 2026
zhihengy
force-pushed
the
dmd2/02-external-data
branch
from
October 21, 2026 06:08
7a190d5 to
d81a40e
Compare
6 tasks done
5 of 6 tasks
Draft
5 of 6 tasks
5 of 6 tasks
Rockdu
force-pushed
the
dmd2/02-external-data
branch
from
November 4, 2026 19:41
d81a40e to
ac2c065
Compare
Rockdu
requested changes
Nov 5, 2026
| logger.info(f"train: rollout {rollout_id} {role} train start") | ||
| ray.get(train_group.async_train(rollout_id, rollout_data_ref)) | ||
| train_outputs[role] = train_group.async_train(rollout_id, rollout_data_ref, train_outputs) | ||
| ray.get(train_outputs[role]) |
Collaborator
There was a problem hiding this comment.
This operation can pull the whole training output into our controller, we should return ray.put(train_output) in train in this case
Rockdu
reviewed
Nov 5, 2026
Collaborator
There was a problem hiding this comment.
Another from agent:
[Nit] docs/fsdp_model_roles.md:40 is stale after this PR: it still says --teacher-load requires a custom prepare/loss hook, but the validator now also accepts --custom-train-output-function-path alone (arguments.py:1735-1743), as cli-reference.md already says. Suggest requires a custom prepare/loss/train-output hook. (The file is outside this diff, so no inline suggestion.)
zhihengy
added a commit
that referenced
this pull request
Nov 9, 2026
`compute` took the old raw-ref hand-off: it ray.get the external_data values directly and returned its output unboxed. With train's output now boxed (#330), unbox `box.inner` here too and return `Box(ray.put(output))`, so the driver's ray.get on a compute phase only waits as well. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
`train` returned its train output directly, so the driver's ray.get on the train refs pulled every rank's output into the controller before the next group read it again from the object store. Return `Box(ray.put(output))` like the rollout shards: the driver gets a small box, the payload stays in the store until the paired rank of a later group unboxes it. Also note the train-output hook as a `--teacher-load` consumer in docs/fsdp_model_roles.md, which cli-reference.md already did. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
zhihengy
force-pushed
the
dmd2/02-external-data
branch
from
November 10, 2026 03:59
e67f3de to
4a513a8
Compare
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.
Third of the DMD2 stacked series, on top of #329. A trainer group can now hand a per-rank result to the groups that train after it on the same rollout. For DMD2, the critic group uses this to pass the teacher's and the critic's predictions to the actor.
What
--custom-train-output-function-path:fn(ctx, train_pairs) -> Any, run without grad after a rollout's train steps.FSDPTrainRayActor.trainreturns its value (Nonewithout the hook).train_diffusion.pykeeps each group's per-rank train refs for the current rollout and passes the earlier groups' refs to the next group.RayTrainGroup.async_train(..., external_data): rank i receives rank i's ref from each earlier group, the pairing upstream miles uses for its critic values. Both groups share the world size and read the same rollout shard, so the paired ranks hold the same train pairs.ctx.external_data[<role>]. Without earlier groups this is{}.--teacher-loadalso counts the new hook as a consumer ofctx.teacher_models.Why
Upstream miles hands the critic's values to the actor the same way:
critic.trainreturns one output per worker, andactor.train(..., external_data=values)gives worker i the output of critic worker i. Here the hand-off goes through Ray object refs, so the payload never passes through the driver and is freed once the rollout's refs go out of scope. The producer side is a hook, like the existing prepare/loss hooks, so the trainer stays role-agnostic.Tests
tests/fast/rollout/test_placement_group.py: each rank receives the same-rank output of every earlier group, and an empty dict without them.tests/fast/test_train_diffusion.py: the second group receives the first group's refs from the same rollout, and the first group receives nothing.tests/fast/utils/test_reference_arguments.py: the train-output hook alone counts as a consumer of--teacher-load.tests/fast/rollout/test_async_training.py,tests/fast/backends/fsdp_utils/test_ema_optimizer.py: updated for the newtrainsignature.Checklist
pre-commithooks (black, isort, ruff at the pinned versions) pass on the changed filespytest tests/fastis green (520 passed, 6 skipped; 518 on [DMD2 2/10] feat(ray): train several colocated trainer groups in the sync driver #329)python3 train_diffusion.py --helpstill parses (the new flag is listed)--custom-train-output-function-pathincli-reference.mdandcustomization.md)Stack
DMD2: distill a flow-matching teacher into a few-step student with distribution matching. Merge in order:
external_data--loss-type dmd2on the actor--dmd2-critic-scoring original, the reference's separate scoring before the critic's last stepA GAN head and other follow-ups come after this series.