Skip to content

Add FSDP CI and end-to-end FSDP tests + save fsdp - #47357

Merged
3outeille merged 40 commits into
mainfrom
split/a-pr-4-2-fsdp-tests-ci
Jul 23, 2026
Merged

Add FSDP CI and end-to-end FSDP tests + save fsdp#47357
3outeille merged 40 commits into
mainfrom
split/a-pr-4-2-fsdp-tests-ci

Conversation

@3outeille

@3outeille 3outeille commented Jul 16, 2026

Copy link
Copy Markdown
Member

CI

Summary

Part of FSDP orchestration stack (2/2). Replaces #46990. #47352 (1/2) → this PR (2/2)

  • Add FSDP DCP (distributed_checkpoint=True) paths in save_pretrained
  • Add FSDP gather into single checkpoint saving
  • Add FSDPTesterMixin and tests/test_fsdp_mixin.py (load/save/generation)
  • Add base_model_fsdp_plan to cohere2_moe (only model in this stack)
  • Add dedicated fsdp_ci CircleCI job and pytest markers

3outeille and others added 19 commits July 16, 2026 02:32
…n 1/3).

Introduce distributed/utils.py and DistributedMixin, defer DistributedConfig
validation to load time, and refactor PreTrainedModel plan properties without
changing the from_pretrained distributed_config API yet.
…SDP orchestration 2/3).

Route distributed loading and saving through DistributedMixin, migrate TP tests
and docs off tp_plan="auto", and add FSDP gather/DCP save paths.
Add FSDPTesterMixin, cohere2_moe base_fsdp_plan, dedicated fsdp_ci job, and
pytest markers for distributed FSDP load/save/generation coverage.
Route distributed load/save orchestration through DistributedMixin so TP and FSDP paths share the same entry points.
@3outeille 3outeille changed the title Wire DistributedConfig through from_pretrained and save_pretrained (F… Add FSDP CI and end-to-end FSDP tests + save/load fsdp Jul 16, 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.

@3outeille
3outeille marked this pull request as ready for review July 21, 2026 05:31
@3outeille 3outeille changed the title Add FSDP CI and end-to-end FSDP tests + save/load fsdp Add FSDP CI and end-to-end FSDP tests + save fsdp Jul 21, 2026
@3outeille
3outeille requested a review from ArthurZucker July 22, 2026 01:36

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

wondering if any of the func in the test fsdp mixin are re-usable at all?

Comment thread tests/test_fsdp_mixin.py
continue
self.skipTest(f"Cannot instantiate model with any Auto class for config {type(config).__name__}")

def _get_tiny_config(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

are you patching to make divisable?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no I am just patching to make it a smaller model overall

Comment thread tests/test_fsdp_mixin.py
"""The model exposes a non-empty `_fsdp_plan` derived from config + class-level overrides."""
if not self._has_fsdp_plan():
self.skipTest("Model does not have an FSDP plan (base_model_fsdp_plan)")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

create model on meta is used only once, not sure we need a func

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: cohere2_moe

@3outeille

Copy link
Copy Markdown
Member Author

run-slow: cohere2_moe

@github-actions

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/cohere2_moe"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 29990924247:1
Result: success | Jobs: 16 | Tests: 173,026 | Failures: 0 | Duration: 15h 16m

@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 7264f02a workflow commit (merge commit)
PR 4012f87a branch commit (from PR)
main c0bd9e62 base commit (on main)

⚠️ Model CI failed to report results

The test failure analysis could not be completed. Please check the workflow run for details.

@3outeille
3outeille added this pull request to the merge queue Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 7264f02a workflow commit (merge commit)
PR 4012f87a branch commit (from PR)
main c0bd9e62 base commit (on main)

⚠️ No test being reported (jobs are skipped or cancelled)!

Merged via the queue into main with commit 9de8a4d Jul 23, 2026
112 of 113 checks passed
@3outeille
3outeille deleted the split/a-pr-4-2-fsdp-tests-ci branch July 23, 2026 09:14
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Jul 30, 2026
* Add distributed runtime utils and DistributedMixin (FSDP orchestration 1/3).

Introduce distributed/utils.py and DistributedMixin, defer DistributedConfig
validation to load time, and refactor PreTrainedModel plan properties without
changing the from_pretrained distributed_config API yet.

* Wire DistributedConfig through from_pretrained and save_pretrained (FSDP orchestration 2/3).

Route distributed loading and saving through DistributedMixin, migrate TP tests
and docs off tp_plan="auto", and add FSDP gather/DCP save paths.

* Add FSDP CI and end-to-end FSDP tests (FSDP orchestration 3/3).

Add FSDPTesterMixin, cohere2_moe base_fsdp_plan, dedicated fsdp_ci job, and
pytest markers for distributed FSDP load/save/generation coverage.

* addd ep_plan

* restore validate module

* Wire DistributedConfig through from_pretrained and save_pretrained.

Route distributed load/save orchestration through DistributedMixin so TP and FSDP paths share the same entry points.

* revert

* inline distribute_model

* revert

* remove saving/loading

* leaner mixin

* downgrade torch version guarding

* remove

* linting

* revert

* revert

* post_init() parallel plan move to mixin

* revert tp mixin

* add save/load

* only FSDP save/load for now

* revert

* refactor

* inline
Sainava pushed a commit to Sainava/Sai-transformers that referenced this pull request Aug 3, 2026
* Add distributed runtime utils and DistributedMixin (FSDP orchestration 1/3).

Introduce distributed/utils.py and DistributedMixin, defer DistributedConfig
validation to load time, and refactor PreTrainedModel plan properties without
changing the from_pretrained distributed_config API yet.

* Wire DistributedConfig through from_pretrained and save_pretrained (FSDP orchestration 2/3).

Route distributed loading and saving through DistributedMixin, migrate TP tests
and docs off tp_plan="auto", and add FSDP gather/DCP save paths.

* Add FSDP CI and end-to-end FSDP tests (FSDP orchestration 3/3).

Add FSDPTesterMixin, cohere2_moe base_fsdp_plan, dedicated fsdp_ci job, and
pytest markers for distributed FSDP load/save/generation coverage.

* addd ep_plan

* restore validate module

* Wire DistributedConfig through from_pretrained and save_pretrained.

Route distributed load/save orchestration through DistributedMixin so TP and FSDP paths share the same entry points.

* revert

* inline distribute_model

* revert

* remove saving/loading

* leaner mixin

* downgrade torch version guarding

* remove

* linting

* revert

* revert

* post_init() parallel plan move to mixin

* revert tp mixin

* add save/load

* only FSDP save/load for now

* revert

* refactor

* inline
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.

3 participants