Fix FSDP2 and distributed checkpointing imports for older PyTorch versions#46141
Merged
3outeille merged 6 commits intoMay 26, 2026
Merged
Conversation
3outeille
approved these changes
May 25, 2026
Member
|
Thanks for your PR ! Ci is not passing because of #46187, @ArthurZucker We can merge this and fix later issues related to |
8f98cbe to
7971318
Compare
7971318 to
a7d46fb
Compare
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
vasqu
added a commit
that referenced
this pull request
May 28, 2026
* Revert "init FSDP through from_pretrained (#46102)" This reverts commit 0588858. * Revert "Fix FSDP2 and distributed checkpointing imports for older PyTorch versions (#46141)" This reverts commit 634500b. * Revert "Update cohere2_moe tp_plan (#46189)" This reverts commit e65c3a2. * Revert "FSDP + TP & native save/load distributed (#45028)" This reverts commit 9ba8e85. * fix * they should have been deleted I think * these are actually needed changes * oops
yuchenxie4645
pushed a commit
to yuchenxie4645/transformers
that referenced
this pull request
May 28, 2026
…sions (huggingface#46141) * Fix PyTorch requirement for FSDP2 to >=2.6 * Fix PyTorch requirement for distributed checkpoint saving to >=2.7 --------- Co-authored-by: Ferdinand Mom <[email protected]>
yuchenxie4645
pushed a commit
to yuchenxie4645/transformers
that referenced
this pull request
May 28, 2026
* Revert "init FSDP through from_pretrained (huggingface#46102)" This reverts commit 0588858. * Revert "Fix FSDP2 and distributed checkpointing imports for older PyTorch versions (huggingface#46141)" This reverts commit 634500b. * Revert "Update cohere2_moe tp_plan (huggingface#46189)" This reverts commit e65c3a2. * Revert "FSDP + TP & native save/load distributed (huggingface#45028)" This reverts commit 9ba8e85. * fix * they should have been deleted I think * these are actually needed changes * oops
kashif
pushed a commit
to kashif/transformers
that referenced
this pull request
Jun 1, 2026
…sions (huggingface#46141) * Fix PyTorch requirement for FSDP2 to >=2.6 * Fix PyTorch requirement for distributed checkpoint saving to >=2.7 --------- Co-authored-by: Ferdinand Mom <[email protected]>
kashif
pushed a commit
to kashif/transformers
that referenced
this pull request
Jun 1, 2026
* Revert "init FSDP through from_pretrained (huggingface#46102)" This reverts commit 0588858. * Revert "Fix FSDP2 and distributed checkpointing imports for older PyTorch versions (huggingface#46141)" This reverts commit 634500b. * Revert "Update cohere2_moe tp_plan (huggingface#46189)" This reverts commit e65c3a2. * Revert "FSDP + TP & native save/load distributed (huggingface#45028)" This reverts commit 9ba8e85. * fix * they should have been deleted I think * these are actually needed changes * oops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR updates the PyTorch version constraints for specific distributed features to prevent
ImportErrorandModuleNotFoundErrorcrashes on older PyTorch versions:>=2.5to>=2.6.>=2.7for distributed checkpoint saving.Currently, attempting to initialize FSDP2 with
torch==2.5results in an import error becauseCPUOffloadPolicy,MixedPrecisionPolicy, andOffloadPolicyare not available in 'torch.distributed.fsdp' for that version.Similarly, attempting to use distributed checkpointing on versions earlier than
torch==2.7crashes becauseHuggingFaceStorageWriterdoes not exist intorch.distributed.checkpoint.hf_storage.Tracebacks
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.