Skip to content

Init the process group with a load-scaled timeout for sharded loading - #48228

Merged
ArthurZucker merged 5 commits into
mainfrom
fix-load-scaled-pg-timeout
Sep 1, 2026
Merged

Init the process group with a load-scaled timeout for sharded loading#48228
ArthurZucker merged 5 commits into
mainfrom
fix-load-scaled-pg-timeout

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Aug 23, 2026

Copy link
Copy Markdown
Member

CPU CI GPU run-slow

What does this PR do?

When transformers initializes torch.distributed itself (the DistributedConfig loading path), the process group gets the default 10-minute NCCL watchdog. Too short for sharded loading of large checkpoints:

  • loading is tens of minutes (GLM-4.6, 665 GiB, 16 ranks: 25–28 min)
  • ranks finish far apart: measured skew >10 min at 16 ranks (the fastest ranks' first collective died on the watchdog while the slowest were still loading). A 50+ min case we initially attributed to skew turned out to be a separate bug (empty FSDP shards; fix incoming) and is not part of this PR's argument.
  • every early rank then dies in its first collective:
Watchdog caught collective operation timeout: WorkNCCL(SeqNum=1, OpType=ALLREDUCE, NumelIn=1, ...) ran for 645901 milliseconds
image

The failure is nasty to diagnose: 0% GPU, all ranks CPU-spinning, no output — it looks like a hang.

Fix: use a 2-hour timeout when transformers creates the group. Users who init the group themselves keep their own timeout.

Note the measurements above are GLM-4.6 (357B, 665 GiB) at 16 ranks — mid-range for this loading path. Larger checkpoints (GLM-5.2 is 1.4 TiB), more nodes, higher-latency filesystems, and configurations with more rank-to-rank variance all widen the spread further.

Found while training GLM-4.6/GLM-5.2 through Trainer (#48204, which carries the same commit).

Part of the loading-performance work tracked in #48239.

Sharded loading of a TB-scale checkpoint takes tens of minutes and ranks
finish far apart (measured: >10 minutes spread on GLM-4.6, 714 GB over 16
ranks), so the fastest ranks' first collective dies on the default 10-minute
NCCL watchdog. Use a 2-hour timeout when transformers initializes the group
itself.
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec
qgallouedec requested a review from 3outeille August 27, 2026 22:45
@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 32874846055:1
Result: failure | Jobs: 2 | Tests: 135,279 | Failures: 0 | Duration: 6h 39m

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ty for finding this

@ArthurZucker
ArthurZucker merged commit 45bd05b into main Sep 1, 2026
110 of 112 checks passed
@ArthurZucker
ArthurZucker deleted the fix-load-scaled-pg-timeout branch September 1, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants