Skip to content

[WIP] Implement the feature to save unsharded weights at the last step #1219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fegin
Copy link
Contributor

@fegin fegin commented May 23, 2025

Summary:
Several users have been asking this feature:
#1177

TODO: Remove fp8 subclass tensor
TODO: Support HF format

Test Plan:

CONFIG_FILE="torchtitan/models/llama3/train_configs/llama3_8b.toml" ./run_train.sh  --training.compile --parallelism.tensor_parallel_degree 4 --parallelism.enable_async_tensor_parallel --checkpoint.model_weights_only --checkpoint.unshard_weights --checkpoint.export_dtype="bfloat16" --training.steps=10 --checkpoint.enable_checkpoint

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 23, 2025
Summary:
Several users have been asking this feature:
#1177

TODO: Remove fp8 subclass tensor
TODO: Support HF format

Test Plan:
```
CONFIG_FILE="torchtitan/models/llama3/train_configs/llama3_8b.toml" ./run_train.sh  --training.compile --parallelism.tensor_parallel_degree 4 --parallelism.enable_async_tensor_parallel --checkpoint.model_weights_only --checkpoint.unshard_weights --checkpoint.export_dtype="bfloat16" --training.steps=10 --checkpoint.enable_checkpoint
```
@@ -365,6 +365,17 @@ class Checkpoint:
The default value is false.
"""

unshard_weights: bool = False
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is WIP, just random thoughts.
unshard_weights doesn't seem to reflect format change -- e.g. I would have thought that unshard_weights means replicated DTensor but still in DCP format

@tianyu-l
Copy link
Contributor

TODO: Support HF format

This would require HF dependency in torchtitan core, right?

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