Add native FSDP2 module + migration (#46707)
* add distributed config
* Add native FSDP2 module and migrate FSDP imports (Phase A PR-2).
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.
* linting
* unecessary
* copyright edit
* revert
* fix
* fix
* remove redundant test file
* Update src/transformers/distributed/fsdp.py
naming
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
* avoid looping, just look at dict
* expand_fsdp returns reshard_targets, no_reshard_targets right away
* better _resolve_tied_embed_lm_head_plan
* cleaning
* ruff
* more robust detection of embed and lm_head
* cleaning
* ruff
* typo
* cleaner
* cleaner
* expand_fsdp_plan iterate over modules
* comment about tie embedding
* add comment tied embedding
---------
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>