Skip to content

[checkpoint] Log when initial load is skipped on resume - #4635

Merged
fegin merged 5 commits into
pytorch:mainfrom
YeonwooSung:pr/warn-initial-load-skipped-on-resume
Sep 16, 2026
Merged

fegin merged 5 commits into
pytorch:mainfrom
YeonwooSung:pr/warn-initial-load-skipped-on-resume

Conversation

@YeonwooSung

@YeonwooSung YeonwooSung commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Resuming from checkpoint.folder is the fault-tolerance path and still wins over initial_load_in_hf / initial_load_path. Users who set those options got no signal at all.

Log the skip at info level when a folder checkpoint is loaded and any initial_* option is set. Precedence is unchanged.

This is the normal restart path rather than a misconfiguration, so it is logged, not warned about (per review). The existing warnings in this file cover settings that can never take effect: load_only with enable_first_step_checkpoint, and initial_load_model_only without initial_load_path.

Addresses #1900.

Test plan

  • Folder resume still loads the folder step, not initial_load_path
  • Skip message logged once at info, and never as a warning, for initial_load_path and for initial_load_in_hf
  • Empty folder still uses the initial load and logs no skip message
  • CI tests/unit_tests/cpu/test_checkpoint.py

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 12, 2026
@tianyu-l
tianyu-l requested a review from ivy-zhou September 12, 2026 08:18
Comment thread torchtitan/components/checkpointer/base.py Outdated
@YeonwooSung YeonwooSung changed the title [checkpoint] Warn when initial load is skipped on resume [checkpoint] Log when initial load is skipped on resume Sep 15, 2026
@tianyu-l
tianyu-l requested a review from fegin September 15, 2026 04:05

@fegin fegin 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.

LGTM, but tests/unit_tests/cpu/test_checkpoint.py seems to be broken by this change. Please check.

Resuming from checkpoint.folder is the fault-tolerance path and still
wins over initial_load_in_hf / initial_load_path. Tell the user those
options were ignored. Addresses pytorch#1900.
Empty-folder loads must not warn. Resume warnings must render the
actual step, not the sentinel -1.
Resuming from checkpoint.folder is the fault-tolerance restart path, and it
runs on every automatic restart of a long job. That is expected behavior, not
a misconfiguration, so a warning on each restart is noise. The existing
warnings in this file cover settings that can never take effect
(load_only with enable_first_step_checkpoint, initial_load_model_only without
initial_load_path); this one is different in kind.

The message itself is unchanged, so the skip is still visible in the log,
which is what pytorch#1900 needed.

Tests now assert the skip message is emitted exactly once at info level and
never as a warning. They match on the rendered message rather than on the
last call, because the load path emits other info lines.
The tests name the checkpoint folder after the running test, so the folder
path contains "initial_load" and the substring filter also matched
"Loading the checkpoint from <path>." That made the positive tests see two
skip messages instead of one.

Filter on "ignoring initial_load_path" instead. The phrase has spaces, so a
path cannot match it. Moving the filter into the helper also drops the
duplicated comprehensions at the call sites.
@YeonwooSung
YeonwooSung force-pushed the pr/warn-initial-load-skipped-on-resume branch from 6afaf98 to 92adda7 Compare September 16, 2026 02:33
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Sep 16, 2026
@pytorch-bot

pytorch-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@tianyu-l
tianyu-l requested a review from fegin September 16, 2026 02:41
TestBaseCheckpointManagerTracing builds the manager as
Mock(spec=BaseCheckpointManager). The spec only covers class attributes, and
initial_load_path / initial_load_in_hf / initial_load_in_hf_quantized are set
in __init__, so reading them from load() raised AttributeError.

Set all three on the fixture. The values keep the new branch untaken, so the
trace-span ordering and no_grad assertions are unaffected.
@fegin
fegin merged commit 810e627 into pytorch:main Sep 16, 2026
17 checks passed
@YeonwooSung
YeonwooSung deleted the pr/warn-initial-load-skipped-on-resume branch September 16, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants