Repository navigation
Conversation
7a190d5 to
d81a40e
Compare
d81a40e to
ac2c065
Compare
| 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]) |
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
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.)
`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>
e67f3de to
4a513a8
Compare
`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>
train returns Box(ray.put(output)); the driver discarded its ray.get and passed the task refs on, so the consumer's box.inner hit an ObjectRef. Keep the boxes the way the rollout shards are kept. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
| return {"scores": [rollout_id]} | ||
|
|
||
| actor = SimpleNamespace( | ||
| args=SimpleNamespace(offload_train=False, debug_rollout_only=False), |
There was a problem hiding this comment.
CC cmt
[P1] This test execs the real train() source, and main's train() (#361) now reads self.args.use_output_store before _train_core, so the fake args here raise AttributeError once the PR is rebased (the file is new, so the merge won't flag it).
test_ema_optimizer.py on main got use_output_store=False for the same reason; please add it here too, plus a materialize_stored_tensors stub in the exec namespace.
779cdf5 to
2dc3538
Compare
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.