Add native FSDP2 module and import migration (Phase A PR-2)#1
Closed
3outeille wants to merge 1 commit into
Closed
Conversation
Move FSDP2 wrapping and plan verification to distributed/fsdp.py, keep integrations/fsdp.py as a backward-compatible re-export, and update core call sites to import from transformers.distributed.fsdp.
Owner
Author
|
Opened on huggingface/transformers instead. |
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.
Summary
src/transformers/distributed/fsdp.pywith FSDP2 wrapping (apply_fully_shard_data_parallel), plan expansion/verification, and FSDP1/2 detectionintegrations/fsdp.pyas a backward-compatible re-export shimaccelerate.py,trainer.py,trainer_seq2seq.py, andgeneration/utils.pyis_fsdp_enabled,is_fsdp_managed_module,verify_fsdp_planfromtransformers.distributedtests/test_distributed_fsdp.pyStacks on: #??? (Phase A PR-1:
split/a-pr-1-distributed-config)Part of: splitting huggingface/transformers#46269
Not included (later PRs)
tests/test_fsdp_mixin.pyintegration tests (needs A-PR-4 orchestration + A-PR-5 model FSDP plans)distributed/utils.py/from_pretrained(distributed_config=...)(A-PR-4)integrations/__init__.pyfsdp exports (kept for BC via re-export)Test plan
pytest tests/test_distributed_fsdp.py tests/test_distributed_config.py -vmake styleintegrations.fsdp.is_fsdp_enabledstill works)integrations.fsdpunchanged (re-export shim)AI assistance was used for this PR.
Made with Cursor