Repository navigation
[DMD2 e2e] test(e2e): 2-GPU H3 DMD2 proxy with a CI-recorded standard - #366
Merged
Merged
Conversation
zhihengy
force-pushed
the
dmd2/06b-h3-dmd2-e2e
branch
from
November 10, 2026 12:53
38a1383 to
adc83da
Compare
6 tasks done
`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>
…re micro-batching
…tprocess Review on #338: `custom_train_input_postprocess_func` says what the hook does, a post-processing step on the converted train pairs. The flag follows the prepare hook's pattern: `--custom-train-input-postprocess-path` sets `args.custom_train_input_postprocess_path`, loaded into `self.custom_train_input_postprocess_func`. Docs and the hook test follow. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
…e the student's samples
… from the critic group's scores
#338 renamed the hook to --custom-train-input-postprocess-path; the DMD2 defaults and the critic override still set custom_train_input_function_path, so --loss-type dmd2 failed in parse_args. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
…metrics to judge it
… reward reads the media
miles/ray/rollout.py imports imageio_ffmpeg to mux the eval audio; the GPU image had it only as a transitive dependency and the hosted CPU suite not at all, so tests/fast/rollout/test_eval_media.py failed to import there. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
zhihengy
force-pushed
the
dmd2/06-h3-recipe
branch
from
November 11, 2026 08:18
3117376 to
37695a1
Compare
zhihengy
force-pushed
the
dmd2/06b-h3-dmd2-e2e
branch
from
November 11, 2026 08:18
adc83da to
350c1d8
Compare
Whether a hook forwards the teacher is the hook's business; the argument layer cannot tell from --loss-type and the hook paths who will read it, so the check only ever guessed. --teacher-load is now accepted under every loss type (dmd2 still requires it).
Stop filling the --custom-*-path arguments on behalf of nft / dmd2 and stop overriding them per trainer role: a group's prepare, formula, train-input and train-output hooks come from loss_hub.LOSS_HOOKS keyed by (loss_type, role), the way miles core's get_loss_function does. Only custom_loss reads the path flags. The critic overrides shrink to the six values that really differ (checkpoint, lr, load/save dirs, steps, batch).
A path given under any other loss type would be silently ignored now that the table selects the hooks, so fail at parse time instead.
DMD2 has no log-prob ratio to recompute, and once the recompute loop passes its real step index the critic's last window would run its scoring prepare and formula a second time. sft_loss and nft already reject the flag.
microbatch_id and optim_step_idx were written onto DiffusionLossContext before every forward and read back by the hooks; the planned micro-batch prefetch would race on them. They are now required keyword arguments of every prepare and formula hook, passed by the two trunk loops; the numbering is unchanged (training from 0, the old-log-prob recompute of windows 1.. reuses their training forwards' numbers).
The DMD2 recipe only knew its 2 x 8 topology. Give it the knobs an e2e needs: --num-nodes / --num-gpus-per-node (one node starts its own ray cluster), --critic-steps-per-rollout, --eval-interval 0 / --save-interval 0 to drop eval and checkpoints (0 used to reach should_run_periodic_action's modulo), --fsdp-cpu-offload and --master-dtype. The three 31B models do not fit two GPUs with their optimizers, so the proxy keeps parameters, gradients and optimizer states in host memory with a bf16 master and steps on the CPU. tests/e2e/short/test_h3_t2va_dmd2_2xGPU.py runs 2 rollouts of 4 prompts (2 critic steps of 2, 1 student step on the last 2) under --deterministic-mode and checks the critic loss and grad norm, the student grad norm and the DMD2 metrics against the recorded standard. The 16-GPU defaults are unchanged. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
…roxy The standard comes from record-e2e-standards.yml on the 3gpu runner (run 42809959116, sglang zhihengy/sglang:dmd2/h3-dmd2-e2e), not from a local run. The test is renamed to the 16xGPU_single_node_2xGPU_proxy form the wan22 and krea2 proxies use, since it runs the 16-GPU recipe shrunk to two GPUs. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
Rockdu
force-pushed
the
dmd2/06b-h3-dmd2-e2e
branch
from
November 11, 2026 13:16
350c1d8 to
daff1b5
Compare
Rockdu
changed the base branch from
dmd2/06-h3-recipe
to
dmd2/08-teacher-in-trunk
November 11, 2026 13:16
record-e2e-standards.yml run 43032161294 on the 3gpu runner, this branch at daff1b5 on sglang-miles 47930723 (the tip with sgl-project/sglang#49440 and #49143, so no ci-sglang-pr override). All 22 metric points match the two records on the previous combo branch bit for bit; only meta.commit moves. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
This was referenced Nov 17, 2026
6 tasks done
Collaborator
|
Thanks for the PR! When I ran this test it was killed by a host-memory OOM: with three full-parameter 31B models offloaded to CPU it takes most of the node's memory, so it fails whenever it overlaps another e2e on the shared node. Could the CI proxy train the student and the critic with LoRA instead? With frozen bf16 bases it should fit on 2 GPUs without CPU offload, while the 16-GPU recipe stays full-parameter. |
…fload The full-parameter 2-GPU proxy keeps about 1.6 TB in host memory and Ray's memory monitor kills it whenever another e2e shares the CI node. The recipe script gets --lora: the student and the critic train LoRA adapters over frozen bf16 bases (about 112 GB per GPU, about 530 GB of host memory), and the e2e test uses it. The 16-GPU recipe stays full-parameter, and --fsdp-cpu-offload still runs it on fewer GPUs. --loss-type dmd2 now accepts --use-lora.
Recorded on the 3gpu CI runner by run 45285320503 at 439990e.
The model page carries recipes meant to be run; the single-node --lora / --fsdp-cpu-offload modes are smoke configurations for CI and development, documented where they live: the recipe script's docstring and the e2e test. The section also copied the docstring word for word.
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.
Update 2026-11-23: the CI proxy trains LoRA adapters
The full-parameter 2-GPU proxy kept about 1.6 TB in host memory, and Ray's memory monitor killed it whenever another e2e shared the CI node: record run 45140738708 ran next to #418's
stage-c-5-gpu-h200and died at 1931.92 / 2013.20 GB, with 1562 GB in this job's own processes. As suggested in review, the proxy now trains LoRA adapters of the student and the critic over frozen bf16 bases. The 16-GPU recipe stays full-parameter.scripts/run_diffusion_dmd2_h3_t2va_16gpu_multinode.py --lora:--use-lora --lora-ipc-weight-sync(rank 64, alpha 128,--sglang-lora-merge-mode merge), lr 1e-4 for both groups, bf16 master.--fsdp-cpu-offloadstill runs the full-parameter recipe on fewer GPUs.--loss-type dmd2accepts--use-lora;--teacher-lora-adapter-pathis still rejected.--lorainstead of--fsdp-cpu-offload;est_time3300 -> 1200.maine6129d0 is merged in (1b40dca).Standard: re-recorded by https://github.com/radixark/miles_diffusion/actions/runs/45285320503 on the 3gpu runner at 439990e. Two local runs (2 x H200, an environment built from the CI recipe) and the CI record agree on all 22 metric points bit for bit. The step-1 values that depend only on the initial models (critic loss, teacher distance, x0 mean and std) equal the full-parameter standard's, as a fresh LoRA leaves the base unchanged.
Coverage: the proxy no longer exercises the full-weight sync, the fp32 master or the CPU-offloaded optimizers. It now exercises the two groups' sleep / wake hand-off, which the CPU-offloaded form skipped.
The sections below describe the earlier full-parameter form of the proxy.
On
main: #372 and the DMD2 stack below it landed on 2026-11-11 andmainis merged in (a38350d, f4cc1d8), so the diff is the two e2e commits plus the standard. The H3 DMD2 recipe gets the knobs a CI proxy needs, and a 2-GPU e2e runs it nightly against a recorded standard.What
scripts/run_diffusion_dmd2_h3_t2va_16gpu_multinode.py:--num-nodes/--num-gpus-per-node(one node starts its own ray cluster, as the other recipes do),--critic-steps-per-rollout,--eval-interval 0and--save-interval 0to run without eval or checkpoints (0 used to reachshould_run_periodic_action's modulo),--fsdp-cpu-offload(also offloads the teacher). The 16-GPU defaults are unchanged.tests/e2e/short/test_h3_t2va_dmd2_16xGPU_single_node_2xGPU_proxy.pyinstage-c-3-gpu-h200, labele2e: 2 rollouts of 4 prompts (4 s, 16:9), 2 critic steps of 2 samples and 1 student step on the last 2,--deterministic-mode. Checkstrain/critic-loss,train/critic-grad_norm,train/grad_normand the DMD2 metrics (dmd2_grad_abs_mean,dmd2_score_gap_abs_mean,dmd2_teacher_dist_abs_mean,dmd2_x0_mean,dmd2_x0_std,x0_mean_abs_diff) bit for bit.docs/models/h3/h3.md: the single-node form and why it needs CPU offload.Stack fixes this run surfaced (on the branches below, not in this PR's diff)
dmd2/02-external-data([DMD2 3/10] feat(ray): hand earlier trainer groups' outputs to later groups as external_data #330):trainreturnsBox(ray.put(output)), but the driver discarded itsray.getand passed the task refs on, so the consumer'sbox.innerhit anObjectRef. The driver now keeps the boxes, asRolloutManager.generatekeeps the shard boxes.dmd2/05-dmd2-loss([DMD2 7/10] feat(dmd2): train the student with the distribution matching gradient from the critic group's scores #334): the DMD2 defaults still setcustom_train_input_function_pathafter [DMD2 4/10] feat(fsdp): add a train-input hook that preprocesses train pairs before micro-batching #338 renamed the hook, so--loss-type dmd2failed inparse_args.Why this shape
--loss-type dmd2trains the student and the critic in full, so student + critic + teacher only fit 2 GPUs with--fsdp-cpu-offload: parameters, gradients and optimizer states live in host memory (about 1.1 TB) and the optimizer steps on the CPU.proj_in/time_embedder/proj_outin fp32 (_keep_in_fp32_modules), and FSDP2 wants one original dtype across a group's trainable parameters; a bf16 master tripsFSDP expects uniform original parameter dtypefor full-parameter training (the H3 SFT e2e gets away with bf16 because LoRA freezes those modules).rollout_stop_step_index, [Feat] diffusion: [sglang-miles] Stop a rollout at a requested step inside the rollout controller sgl-project/sglang#49440) and the skipped decode (rollout_return_generated_output=False, [Feat] diffusion: [sglang-miles] Let a rollout request skip the VAE decode and return only its trajectory sgl-project/sglang#49143); both merged intosglang-mileson 2026-11-11, so CI runs on the default engine with noci-sglang-*override. The e2e asks for no generated output, so it needs nothing else.Local run (2 x H200, this node)
The CI arg set, in the e2e tree (torch 2.13 with the ad-hoc param-dtype patch port, sglang
dmd2/h3-dmd2-e2e), on an otherwise idle pair of H200s. It passes end to end in 50 min; every registered metric is emitted at the expected steps (critic steps 1-4, student steps 1-2).The time is the two offloaded 31B optimizers, so
est_time=3300liftsrun_suite's per-file cap to 4125 s (max(timeout_per_file, 1.25 x est_time)); the nightly 3gpu job grows by about 50 min. Smaller is not available: sglang's H3 pins 1344x768 and >= 4 s, and the checkpoint materialization is 20 of the 50 minutes regardless of the rollout count.Standard
The standard is recorded on the CI runner with
record-e2e-standards.yml(runs_on: ["h200","3gpu"], the same sglang ref), not locally: the local tree runs torch 2.13 with an ad-hoc port of the FSDP param-dtype patch and would not match bit for bit.Record run: https://github.com/radixark/miles_diffusion/actions/runs/43032161294 (48 min on the 3gpu runner, this branch at daff1b5 on
sglang-miles47930723, the tip with #49440 and #49143); the artifact is committed astests/ci/fixtures/e2e_standards/test_h3_t2va_dmd2_16xGPU_single_node_2xGPU_proxy.json. The test file is named..._16xGPU_single_node_2xGPU_proxy.pylike the wan22 and krea2 proxies.Reproducibility: the two earlier records on the previous combo branch (
dmd2/h3-dmd2-e2e, a 2026-10-13sglang-milesbase that shares no history with today's rebuilt branch; runs 42809959116 and 42875943793) and this one on the rebuiltsglang-milesagree on all 22 metric points bit for bit, so the commit only movesmeta.commit. A first record on the rebuilt branch (run 43004893234) died inFSDPTrainRayActorinit with Ray's host-memory OOM: the 3gpu and 5gpu runners share one node (2013 GB), this job's four offloaded actors plus the engine take about 1.5 TB as Ray counts RSS, and a 5gpu e2e was running at the time. The record has to run while the 5gpu runner is idle, and the nightly will hit the same wall whenever the two e2e suites overlap.PR Test with
run-ci-e2e: https://github.com/radixark/miles_diffusion/actions/runs/43125180885 is green on the merge of this branch andmain841089c. The 3gpu e2e suite passed in one go (1 h 39 min; this test 50.6 min, 9 metric series match). The 5gpu suite needed two reruns for failures outside this PR: cosmos3's engine found port 15002 still held by the previous test's engine (address already in use), then a Ray worker died in Ray's OpenTelemetry exporter (getenvSIGSEGV underOtlpGrpcMetricExporter::Export); themainnightly 43132910928 passed the same suite in between.Earlier PR Tests ran the whole suite on the previous combo branch through a
ci-sglang-proverride; there the sd3 NFT and wan22 standards drifted at step 2+ and the hosted CPU suite lackedradix_transfer_plugins.stashes.tensor_stash(runs 42819564862, 43027602064). With the override gone the suite runs every standard on the engine it was recorded with.Checklist
pre-commithooks pass on the changed filespython3 scripts/run_diffusion_dmd2_h3_t2va_16gpu_multinode.py --helpstill parses; the CI arg set and the 16-GPU defaults both go throughparse_args