Skip to content

Keep a rank's own error when the gather of the data position checks fails - #795

Draft
amazloumi wants to merge 4 commits into
fix/data-pipeline-startup-errorsfrom
fix/position-check-own-error
Draft

amazloumi wants to merge 4 commits into
fix/data-pipeline-startup-errorsfrom
fix/position-check-own-error

Conversation

@amazloumi

@amazloumi amazloumi commented Dec 6, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A rank whose check of a resumed data position failed or refused keeps its own error when the gather of the checks fails. CheckpointManager.apply_dataloader_state has every rank check the kept position with its loader's check_state, and _position_refusals shares the verdicts with all_gather_object on the manager's gloo group before any rank applies it. When that gather itself failed, as when another rank reached it only after the group's timeout (distributed.nccl_timeout_sec) or its process exited, a rank whose check had failed (such as one that could not see a data file) or had refused the position raised only the gather's error, so no rank's output said why the position could not be applied. In When the gather of a resumed data position's checks fails, a rank whose check failed or refused raises only the collective's error, not its own #790's reproduction, which gives the group a 5 s timeout, that error is gloo's Timed out waiting 5000ms for send operation to complete. The gather now runs through run_keeping_own_error, with this rank's refusal built as a DataPositionError before it: that rank raises its own error, with the gather's failure in a note (in the reproduction, Checking the saved data position could not be agreed across ranks: RuntimeError: ... Timed out waiting 5000ms for send operation to complete), and a rank whose check passed raises the gather's failure with the note Checking the saved data position succeeded on this rank but could not be agreed across ranks.
  • A refusal is kept only where it raises, on a resume. After a warm_start load, or on a position that checkpoint.ignore_rank_state_mismatch carried onto a changed topology, a refusal only restarts the data on every rank, with a warning, when the gather completes, so a rank whose check refused there raises the gather's failure when it fails, as a rank whose check passed does. So that its reason is not lost, that rank first logs it as a warning that shows on any rank (not only rank 0), names the rank and says the run stops: The saved data position does not carry over to this run on rank 1, and sharing the ranks' checks of it failed, so the run stops: .... A check that failed is kept in every case, since it is raised in every case when the gather completes. The logs when the gather completes are unchanged.
  • The success path and the path without a process group are unchanged: no new collective, and the same errors when the gather completes. The docstrings of apply_dataloader_state and _position_refusals say what a rank raises when the gather fails, and codebase-map.json updates the _position_refusals entry and counts the new tests.
  • Builds on Agree on the data build across ranks and name a refused step-0 data phase #776: it uses the run_keeping_own_error that Agree on the data build across ranks and name a refused step-0 data phase #776 adds, and moves to main when Agree on the data build across ranks and name a refused step-0 data phase #776 merges.

Testing

Every tier below ran at the head, 84154b7c, which contains #776's head 7d61eb9e.

  • ruff check .: clean; ruff format --check .: 353 files formatted; pyright kempnerforge/: 0 errors
  • Docs: sphinx-build -W --keep-going -b html docs ...: build succeeded
  • Unit, Python 3.12, under coverage as CI runs it (pytest tests/unit --timeout=60 --cov --cov-branch): 6788 passed, 14 skipped (13 need CUDA, 1 needs the network), and the cluster-only timeout of test_pipeline_checkpoint_layouts.py::TestAcrossRanks::test_the_stages_continue_a_run_saved_without_pp[muon-pp3], which runs past the 60 s limit on a busy cluster CPU node and passed alone here with a longer limit.
  • Unit, Python 3.14: 6786 passed, 14 skipped (13 need CUDA, 1 needs the network), and three cluster-only timeouts, each of which passed alone here with a longer limit: test_pipeline_checkpoint_layouts.py::TestAcrossRanks::test_the_stages_continue_a_run_saved_without_pp[muon-pp3], and test_streaming_resume.py::test_a_pass_restarted_midway_draws_a_new_base_seed_that_a_resume_keeps and test_streaming_resume.py::test_a_load_into_a_running_stream_starts_new_workers_from_the_loaded_state, whose stream workers ran past the 60 s limit beside the other unit tiers.
  • Unit at the dependency floors (Python 3.12.16, torch 2.12.0, numpy 1.26.1, pandas 2.1.2, pyarrow 15.0.0; scripts/check_dependency_floors.py --group video passes): 6787 passed, 15 skipped (13 need CUDA, 1 needs the network, 1 needs mlflow.telemetry, which the mlflow floor lacks), and the same cluster-only timeout of test_pipeline_checkpoint_layouts.py::TestAcrossRanks::test_the_stages_continue_a_run_saved_without_pp[muon-pp3], which passed alone here with a longer limit.
  • Examples, as ci-example.yml runs them, on Python 3.14 and 3.12: examples/vlm/tests (without eval/integration) 407 passed, examples/image_understanding/tests 1587 passed and examples/assembled_run/tests 12 passed, on each
  • Integration (1 H200): pytest tests/integration: 157 passed
  • E2E (4 H200): pytest tests/e2e --e2e --slow: 54 passed
  • Distributed (4 H200): torchrun --nproc_per_node=4 -m pytest tests/distributed --slow: 213 passed on every rank
  • Smoke on 4 H200: the image-understanding example's VLM (frozen SigLIP2 encoder, 28-layer decoder) under FSDP2 over 4 ranks: train 200 steps and save, auto-resume ("Resumed from step 200, 13,107,200 tokens seen", the DataLoader position kept and applied) to step 400 and save, with no logged step repeated; step 400 evaluated on 4 ranks and on 1 rank gives byte-identical predictions on all 765 rows. Training windows RealUtil 48.4%.
  • The eight new test cases fail at Agree on the data build across ranks and name a refused step-0 data phase #776's head, 7d61eb9e, with this branch's test file, and pass here:
    • test_a_check_that_failed_or_refused_raises_its_own_error_when_the_gather_times_out (2 cases; two gloo ranks, a 5 s timeout on the checkpoint manager's group; rank 1's check fails at once with FileNotFoundError or refuses with DataPositionError, and rank 0 checks only once rank 1's wait in the gather has timed out): at Agree on the data build across ranks and name a refused step-0 data phase #776's head rank 1 raises only gloo's Timed out waiting 5000ms for send operation to complete; here it raises its own error, with the gather's failure in a note, and rank 0's error notes the check.
    • test_a_failed_gather_keeps_a_ranks_own_error_and_logs_a_refusal_that_does_not_raise (6 cases; the gather made to raise after a resume, a warm start and a position that checkpoint.ignore_rank_state_mismatch carried onto a changed world size, for a failed check and a refusal): at Agree on the data build across ranks and name a refused step-0 data phase #776's head all six raise the gather's error with no note; here a failed check raises its own error with the gather's failure in a note after each, as a refusal does on the resume, and after the warm start and on the carried position a refusal is logged as a warning that the training log's rank-0 filter lets through on rank 1, then the gather's failure raised with a note naming the check.
  • The existing gloo tests of a gather that completes pass unchanged in every unit tier above (tests/unit/test_streaming_resume.py: a flag resume and a warm start restarting every rank when one rank sees a data file at another size, every rank raising without the flag, and every rank stopping when one rank's check fails another way).
  • When the gather of a resumed data position's checks fails, a rank whose check failed or refused raises only the collective's error, not its own #790's reproduction, run as its body shows it: at ce2d5c61 rank 1 raises only gloo's timeout in both late runs; at 84154b7c it raises FileNotFoundError: [Errno 2] No such file or directory: 'train-00001.jsonl' and DataPositionError: The data changed since the save: a data file changed size, with the timeout in a note, and the on time lines are unchanged.
  • Every added line and branch in kempnerforge/ is covered in one process, by tests/unit/test_data_position.py.

Closes #790

…ails

apply_dataloader_state has every rank check the kept data position with
its loader's check_state, and _position_refusals shares the verdicts with
one all_gather_object on the manager's gloo group. When that gather itself
failed, for example with a gloo timeout because another rank reached it
only after the group's timeout, a rank whose check had failed or refused
raised the gather's error alone. The gather now runs through
run_keeping_own_error, with the rank's refusal built as a
DataPositionError before it: such a rank raises its own error with the
gather's failure in a note, and a rank whose check passed raises the
gather's error with a note naming the check. A refusal is kept only where
it raises, on a resume: after a warm start or on a carried position it
only restarts the data, so there the rank raises the gather's failure.
The success path and the path without a process group are unchanged.

A two-rank gloo test lets the gather time out on a rank whose check
failed or refused, and a test with the gather made to fail covers the
warm start.
@amazloumi amazloumi added the core Affecting core label Dec 6, 2026
After a warm start, or on a position carried by
checkpoint.ignore_rank_state_mismatch, a refusal only restarts the data,
so a rank whose check refused raises the gather's failure when the gather
of the checks itself fails, and its refusal showed nowhere. That rank now
first logs why its check refused, as a warning that says the run stops.
It still raises the gather's failure, and the logs when the gather
completes are unchanged.

The test with the gather made to fail now covers a resume, a warm start
and a position carried onto a changed world size, for a failed check and
a refusal, with the warning. The docstring of _position_refusals lists
the gather's own failure under Raises.
The warning that a rank whose check refused logs when the gather of the
checks fails, after a warm start or on a carried position, went through
the training log's handler, which drops a record on any rank but 0
unless it is marked for every rank. Only that rank knows why its check
refused, so the warning is now marked every_rank, and the test checks
that it passes the rank-0 filter on rank 1.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Affecting core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant