Skip to content

Reinitialize ModelWrapper.cache_state_dict because set_model_state_dict has side effects - #971

Merged
fegin merged 2 commits into
gh/fegin/4/basefrom
gh/fegin/4/head
Mar 17, 2025
Merged

fegin merged 2 commits into
gh/fegin/4/basefrom
gh/fegin/4/head

Conversation

@fegin

@fegin fegin commented Mar 17, 2025 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Summary:
Fixes #961

set_model_state_dict has side effect over the input state_dict keys.

Test Plan:

NGPU=4 CONFIG_FILE="torchtitan/models/llama/train_configs/debug_model.toml" ./run_train.sh --training.compile --checkpoint.enable_checkpoint --training.steps=100 --checkpoint.interval=100
NGPU=4 CONFIG_FILE="torchtitan/models/llama/train_configs/debug_model.toml" ./run_train.sh --training.compile --checkpoint.enable_checkpoint --training.steps=200 --checkpoint.interval=100
NGPU=4 CONFIG_FILE="torchtitan/models/llama/train_configs/debug_model.toml" ./run_train.sh --training.compile --checkpoint.enable_checkpoint --training.steps=300 --checkpoint.interval=100

The last command will fail without this PR

[ghstack-poisoned]
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 17, 2025
@fegin fegin changed the title Reinit ModelWrapper.cache_state_dict because set_model_state_dict side effects Reinitialize ModelWrapper.cache_state_dict because set_model_state_dict side effects Mar 17, 2025
@fegin fegin changed the title Reinitialize ModelWrapper.cache_state_dict because set_model_state_dict side effects Reinitialize ModelWrapper.cache_state_dict because set_model_state_dict has side effects Mar 17, 2025
@fegin
fegin requested a review from fduwjj March 17, 2025 18:46
[ghstack-poisoned]
@fegin
fegin merged commit 2425960 into gh/fegin/4/base Mar 17, 2025
fegin added a commit that referenced this pull request Mar 17, 2025
…_state_dict has side effects (#977)

Reland #971 due to ghstack
issues.
MaxiBoether pushed a commit to eth-easl/torchtitan-mixtera that referenced this pull request Apr 17, 2025
…_state_dict has side effects (pytorch#977)

Reland pytorch#971 due to ghstack
issues.
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 13, 2026
…_state_dict has side effects (pytorch#977)

Reland pytorch#971 due to ghstack
issues.
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 25, 2026
…_state_dict has side effects (pytorch#977)

Reland pytorch#971 due to ghstack
issues.
@fegin
fegin deleted the gh/fegin/4/head branch June 30, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants