Skip to content

fix(checkpointing): remove identical if/else arms and leftover debug print in WriterFactory - #8446

Closed
simpleqt wants to merge 1 commit into
deepspeedai:masterfrom
simpleqt:fix/writer-factory-dead-branch
Closed

simpleqt wants to merge 1 commit into
deepspeedai:masterfrom
simpleqt:fix/writer-factory-dead-branch

Conversation

@simpleqt

@simpleqt simpleqt commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

In deepspeed/runtime/model_checkpointing/writer_factory.py:

  1. The pure_dp if/else computed the byte-identical expression in both arms (AST-verified) — collapsed to a single assignment.
  2. Removed an unconditional print(f'WriterFactory: …') debug line that was dumped to stdout of every user process constructing the fast checkpoint writer (deepspeed/runtime/checkpoint_engine/fast_checkpoint_engine.py).

Checklist

  • python -m py_compile passes on the touched file
  • No behavior change beyond removing stdout noise

Signed-off-by: simpleqt 89645338+simpleqt@users.noreply.github.com

Copilot AI lite review requested due to automatic review settings September 6, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9324cc49e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 34 to 35
print(
f'WriterFactory: self._data_parallel_writer={self._data_parallel_writer} self._show_statistics={self._show_statistics}'
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the now-empty print call

Every CheckpointWriterFactory construction still executes print(), so distributed checkpoint runs now emit one blank line per participating process. This leaves the debug side effect in place (and can pollute machine-readable stdout or logs); delete the call itself rather than only its argument.

Useful? React with 👍 / 👎.

…print in WriterFactory

Both arms of the pure_dp conditional computed the same expression
(AST-verified), and the constructor unconditionally printed a debug
line to stdout of every user process that enables the fast checkpoint
writer. Collapsed the conditional and removed the print.

Signed-off-by: simpleqt <89645338+simpleqt@users.noreply.github.com>
@simpleqt
simpleqt force-pushed the fix/writer-factory-dead-branch branch from 9324cc4 to 9d74c0e Compare September 6, 2026 19:39
@hwchen2017

Copy link
Copy Markdown
Contributor

Closing this as the changes were merged in #8689

@hwchen2017 hwchen2017 closed this Sep 28, 2026
tranzmatt pushed a commit to tranzmatt/DeepSpeed that referenced this pull request Sep 28, 2026
Consolidate the reviewed documentation fixes, typo corrections, and
small runtime cleanups from the original PRs below.

**Credit to @simpleqt for the original contributions.** The
cherry-picked commits preserve the original authorship and sign-offs.
This PR combines the valid changes, avoids duplicate edits, and adjusts
changes that no longer match the current code or documentation.

- Fix broken tutorial links, documentation anchors, and Python API
references.
- Correct parameter names, missing argument documentation, duplicated
words, and garbled text in docstrings, comments, and documentation.
- Simplify identical branches in the checkpoint writer and ZenFlow
gradient-copy path, restore the gradient assertion, and remove the
checkpoint writer's unconditional debug print.
- Additionally, repair the remaining ZeRO-3 Offload tutorial link so it
points to the current ZeRO-3/ZeRO-Infinity section.

## Original PRs

| Original PR | Change incorporated |
| --- | --- |
| [deepspeedai#8445](deepspeedai#8445) | Restore
the non-None gradient assertion and remove the duplicated ZenFlow
gradient-copy branch. |
| [deepspeedai#8446](deepspeedai#8446) | Remove
identical checkpoint-writer branches and the unconditional constructor
debug print. |
| [deepspeedai#8449](deepspeedai#8449) | Point
CONTRIBUTING's installation link to `README.md#installation`. |
| [deepspeedai#8450](deepspeedai#8450) | Include
only the `max_norm` documentation; omit the obsolete `use_graph` entry.
|
| [deepspeedai#8545](deepspeedai#8545) | Both
scheduling-docstring corrections are covered by deepspeedai#8599, so they are
included only once. |
| [deepspeedai#8546](deepspeedai#8546) | Correct
the "Add a new workflow" anchor in `TEST_SELECTION.md`. |
| [deepspeedai#8593](deepspeedai#8593) | Correct
the two 1Cycle tutorial links to `/tutorials/one-cycle/`. |
| [deepspeedai#8594](deepspeedai#8594) | Retain
the two valid URL case corrections in the ZeRO-3 Offload post; handle
its final tutorial link separately as described below. |
| [deepspeedai#8595](deepspeedai#8595) | Correct
the Megatron example to use
`deepspeed.checkpointing.get_cuda_rng_tracker`. |
| [deepspeedai#8596](deepspeedai#8596) | Correct
`deepspeed.com.log_summary` to `deepspeed.comm.log_summary`. |
| [deepspeedai#8597](deepspeedai#8597) | Point
the AutoTP supported-models link to the correct Read the Docs page and
anchor. |
| [deepspeedai#8598](deepspeedai#8598) | Align
the `fp_quantize` docstring's parameter names with its signature. |
| [deepspeedai#8599](deepspeedai#8599) | Remove
duplicated words and garbled fragments in scheduling docstrings, runtime
comments, and documentation. |

## Integration adjustments

- **deepspeedai#8450:** `use_graph` was removed by
[deepspeedai#8579](deepspeedai#8579), so only the
still-applicable `max_norm` documentation is retained.
- **deepspeedai#8594:** Its proposed final destination, `/tutorials/zero-offload/`,
teaches ZeRO stage 2 optimizer offloading. Instead, this PR separately
updates the ZeRO-3 tutorial link to [Training trillion-scale models with
ZeRO-Infinity](https://www.deepspeed.ai/tutorials/zero/#training-trillion-scale-models-with-zero-infinity),
which documents stage 3 and CPU parameter/optimizer offloading.
- **deepspeedai#8545 and deepspeedai#8599:** The overlapping scheduling-docstring fixes are
incorporated through deepspeedai#8599 rather than duplicated.

---------

Signed-off-by: simpleqt <89645338+simpleqt@users.noreply.github.com>
Signed-off-by: Hongwei Chen <hongweichen@microsoft.com>
Co-authored-by: simpleqt <89645338+simpleqt@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants