Skip to content

Add native FSDP2 module and import migration#46706

Closed
3outeille wants to merge 1 commit into
huggingface:split/a-pr-1-distributed-configfrom
3outeille:split/a-pr-2-fsdp-module
Closed

Add native FSDP2 module and import migration#46706
3outeille wants to merge 1 commit into
huggingface:split/a-pr-1-distributed-configfrom
3outeille:split/a-pr-2-fsdp-module

Conversation

@3outeille

@3outeille 3outeille commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Add src/transformers/distributed/fsdp.py with FSDP2 wrapping (apply_fully_shard_data_parallel), plan expansion/verification, and FSDP1/2 detection
  • Keep integrations/fsdp.py as a backward-compatible re-export shim
  • Migrate core imports in accelerate.py, trainer.py, trainer_seq2seq.py, and generation/utils.py
  • Export is_fsdp_enabled, is_fsdp_managed_module, verify_fsdp_plan from transformers.distributed
  • Add unit tests in tests/test_distributed_fsdp.py

Stacks on: #46705

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.
@3outeille 3outeille changed the title Add native FSDP2 module and import migration (Phase A PR-2) Add native FSDP2 module and import migration Jun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CI Dashboard: View test results in Grafana

⚠️ Code quality check failed — all test jobs were skipped. Fix the code quality issues and push again to run tests.

@3outeille 3outeille closed this Jun 17, 2026
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@github-actions

Copy link
Copy Markdown
Contributor

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=46706&sha=22d4b5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants