Skip to content

Reuse workers for safetensors consolidation tests - #197694

Closed
d4l3k wants to merge 1 commit into
gh/d4l3k/184/basefrom
gh/d4l3k/184/head
Closed

d4l3k wants to merge 1 commit into
gh/d4l3k/184/basefrom
gh/d4l3k/184/head

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Reuse distributed workers for checkpoint consolidation while keeping no-process-group tests in a separate fresh-process class. Preserve all test bodies and the existing rank count.

Test plan: CUDA build and lint; all seven cases normally, in reverse order, on two GPUs and CPU, and after build. Baseline 33.43s; reused workers 15.32s before rebuild. AST comparison verifies every method body unchanged.

@pytorch-bot

pytorch-bot Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/197694

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c545ad5 with merge base b7954b2 (image):
💚 Looks good so far! There are no failures yet. 💚

🟢 GREEN LIGHT - PR approved to be merged without human review:

  • Scope
    • Confined to test/distributed/checkpoint/test_consolidate_hf_safetensors.py; no production or CI-workflow file is touched in the diff
    • Splits the file into TestConsolidateHFSafeTensors (continuous workers) and a new TestConsolidateHFSafeTensorsNoProcessGroup(DTensorTestBase) for the three PG-free cases
  • Test preservation
    • The three moved methods are byte-identical between the removed hunk at old lines 163-238 and the added block at test_consolidate_hf_safetensors.py:249-381
    • The moved class keeps DTensorTestBase and no decorators, so those three run exactly as before
  • Rank count
    • world_size = NUM_DEVICES at line 31 matches the DTensorTestBase.world_size property it replaced (common_dtensor.py:790-792), so the spawned rank count is unchanged
    • MultiProcContinuousTest._ensure_processes_spawned reads world_size via inspect.getattr_static before setting it (common_distributed.py:2093-2107), so the class attribute is required here, not the inherited -2
  • Harness compatibility
    • with_comms passes through on this base: it early-returns unless init_pg exists (common_dtensor.py:894-896), and MultiProcContinuousTest defines only the classmethod _init_pg
    • skip_if_lt_x_gpu's sys.exit is translated to unittest.SkipTest by _worker_loop (common_distributed.py:1978-1992), and with_temp_dir already handles both the initialized and uninitialized cases (checkpoint_utils.py:135-164)
    • Same DTensorContinuousTestBase + with_comms + explicit world_size pattern as test/distributed/checkpoint/test_state_dict_utils.py:32-36

reason: clean
Reviewed commit: c545ad5

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@Skylion007

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 19, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions
github-actions Bot deleted the gh/d4l3k/184/head branch November 24, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants