Skip to content

fix(trainer): preserve failures during async teardown - #238

Closed
CjhHa1 wants to merge 13 commits into
Tencent-Hunyuan:mainfrom
CjhHa1:fix/async-trainer-teardown-192
Closed

fix(trainer): preserve failures during async teardown#238
CjhHa1 wants to merge 13 commits into
Tencent-Hunyuan:mainfrom
CjhHa1:fix/async-trainer-teardown-192

Conversation

@CjhHa1

@CjhHa1 CjhHa1 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • preserve the primary training failure when final async draining also fails
  • always flush pending checkpoints and close WandB, including resume-sync and baseline-eval failures
  • share the teardown guard across AsyncARTrainer and AsyncDiffusionTrainer
  • add CPU-only coverage for clean exit, drain failure, primary-error preservation, and KeyboardInterrupt

Dependency

Stacked on #192 because the shared fix covers its new AsyncDiffusionTrainer. Keep this PR draft until #192 merges; its diff against main will then collapse to the teardown changes.

Test plan

  • PYTHONPATH=$PWD python3 -m pytest -q tests/test_async_teardown.py (4 passed)
  • pre-commit run --files unirl/trainer/base.py unirl/trainer/async_ar.py unirl/trainer/async_diffusion.py tests/test_async_teardown.py
  • async diffusion Hydra compose (--cfg job --resolve)

zzhuoxin1508 and others added 13 commits July 8, 2026 14:40
…usion RL

Diffusion sibling of AsyncARTrainer: subclasses DiffusionTrainer(layout=separate)
to reuse the two-slab build + NCCLWeightSync handshake, and overlays the async
rollout buffer loop (non-blocking generate, reap-time reward scoring off the train
critical path, buffer of scored GRPO groups, train consumes the freshest batch).
Knobs: max_inflight (overlap depth), buffer_max_staleness (0=on-policy).

Adds unirl/trainer/async_diffusion.py, unirl/train_async_diffusion.py, and
examples/diffusion/sd3/sd3_vllmomni_async.yaml. Purely additive.
…segment transfer, add BAGEL async recipe, drop SD3 async recipe
Default Hydra config still pointed at the dropped SD3 async yaml. Point
train_async_diffusion at bagel_vllmomni_async and set buffer_max_staleness=2
(the throughput-optimal knob from the PR validation table).
Evaluate the resident rollout policy without syncing or offloading the async engine, while preserving synchronous defaults and forwarding configured eval suites.
State consistently that generation overlaps training while reap-time reward scoring remains synchronous.
Fail before worker construction unless max_inflight is exactly one, preserving the idle-worker window required by reap-time transfer.
Record the train slab fraction and describe the actual remote LoRA sync and bounded policy-lag ratio semantics without changing runtime behavior.
Protect resume/eval initialization and ensure secondary drain errors cannot mask the primary failure or skip checkpoint and logger finalization.
@github-actions github-actions Bot added the wip Draft / work in progress label Jul 21, 2026
@CjhHa1

CjhHa1 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #239. Main merged the generic async runtime in #211 while this draft was being prepared, so the replacement narrows the follow-up to AsyncDiffusionTrainer and stacks cleanly on the latest main + #192.

@CjhHa1 CjhHa1 closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wip Draft / work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants