transformers
[Umbrella] FSDP2 + expert-parallel token dispatch, with sharded-loading prefetch
#48204
Open

[Umbrella] FSDP2 + expert-parallel token dispatch, with sharded-loading prefetch #48204

qgallouedec wants to merge 316 commits into main from ep-fsdp-2d-mesh
qgallouedec
HuggingFaceDocBuilderDev
qgallouedec qgallouedec changed the title Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh [Umbrealla] Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh 30 days ago
qgallouedec qgallouedec changed the title [Umbrealla] Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh [Umbrella] Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh 30 days ago
3outeille 3outeille assigned 3outeille 3outeille 29 days ago
qgallouedec Merge remote-tracking branch 'origin/fix-ep-training-gradients' into …
2d8108d5
qgallouedec Merge remote-tracking branch 'origin/ep-fsdp-2d-mesh' into ep-fsdp-2d…
b13f35b6
qgallouedec Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh
e3a43b26
qgallouedec Gather the sharded state dict through the model's own save helpers
71fcd09a
qgallouedec Document combining expert parallelism with FSDP2
bba3125e
qgallouedec Address review: drop the dead expert-gradient sync, torch-native mixe…
ad5df191
qgallouedec Give each device mesh its own optimizer param group instead of steppi…
c18e5d99
qgallouedec Test the 2-D mesh with a batch split across the fsdp ranks and compar…
508996b6
qgallouedec Refresh the throughput table
ef412569
qgallouedec Cosmetic: docstring layout, comment placement, doc link
393af534
qgallouedec Merge branch 'fsdp2-ep-2d-mesh' into ep-fsdp-2d-mesh
724c6f91
qgallouedec Restore the shard prefetch helper dropped in the merge
b4045930
qgallouedec Gate the per-matmul sentinel masks on expert parallelism (#48201 x #4…
51177c78
qgallouedec Load: convert transposed and RoPE-permuted weights in full before tak…
bb3a775d
qgallouedec Let conversion ops declare the dims they move; defer the shard only w…
9e2bca95
qgallouedec Keep the decision in one helper
d83a1f72
qgallouedec Merge branch 'main' into moe-skip-ep-sentinels-v2
9987b909
qgallouedec Merge branch 'main' into load-shard-prefetch
1bd524ae
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
8aa54334
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
84c5e320
qgallouedec Merge branch 'main' into load-shard-prefetch
14f0a81c
qgallouedec Merge branch 'main' into moe-skip-ep-sentinels-v2
2e4efe73
qgallouedec Merge branch 'main' into ep-fsdp-2d-mesh
75b74f8e
qgallouedec Merge branch 'main' into load-shard-prefetch
07eb49e4
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
a6b88157
qgallouedec Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh
2414cedf
qgallouedec Gather the sharded state dict through the model's own save helpers
4914e5ae
qgallouedec Document combining expert parallelism with FSDP2
489714fe
qgallouedec Fix NaN gradients in expert-parallel training: mask uninitialized gro…
91ad4af2
qgallouedec Address review: drop the dead expert-gradient sync, torch-native mixe…
f9e24a39
qgallouedec Fix wrong gradients for all non-expert parameters in expert-parallel …
50d95d25
qgallouedec Give each device mesh its own optimizer param group instead of steppi…
683176d4
qgallouedec Trim comments
86dbd5a4
qgallouedec Test the 2-D mesh with a batch split across the fsdp ranks and compar…
a8301666
qgallouedec Gate the router-score backward all-reduce on grad mode; drop the post…
036caf30
qgallouedec Refresh the throughput table
ef86f595
qgallouedec Fix expert parallelism through Trainer (#48208)
0e5d1ebc
qgallouedec Cosmetic: docstring layout, comment placement, doc link
d9394c9e
qgallouedec Carry is_expert_parallel on the test experts stand-ins
eb9dafc6
qgallouedec Read _device_mesh directly and hoist the itertools import
c64443d6
qgallouedec Merge remote-tracking branch 'origin/main' into ep-fsdp-2d-mesh
28d58f03
qgallouedec Merge remote-tracking branch 'pr/48201' into ep-fsdp-2d-mesh
4f51f0d5
qgallouedec Merge remote-tracking branch 'pr/48227' into ep-fsdp-2d-mesh
e2bf5ee6
qgallouedec Merge remote-tracking branch 'pr/48237' into ep-fsdp-2d-mesh
d0e12fff
qgallouedec Merge remote-tracking branch 'pr/48205' into ep-fsdp-2d-mesh
09db09fd
qgallouedec Merge remote-tracking branch 'pr/48516' into ep-fsdp-2d-mesh
36662856
qgallouedec Merge branch 'main' into moe-skip-ep-sentinels-v2
2ec1d59c
qgallouedec Merge branch 'main' into load-shard-prefetch
9059c09e
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
9c00001a
qgallouedec Merge branch 'main' into load-convert-before-shard
324b3116
qgallouedec Prefetch only the byte spans each rank will read
b01da96b
qgallouedec Cover per-expert checkpoints, and compare against a fair share of the…
69e08c23
qgallouedec Warm short ranges with kernel readahead, and bridge cheap gaps
862086dc
qgallouedec Take the meta state dict again, not named_parameters
cca1d864
qgallouedec Decide readahead on the total a rank warms, not the size of each range
f2c47436
qgallouedec Set is_expert_parallel at the call site instead of threading a parameter
a66940a0
qgallouedec Merge branch 'main' into moe-skip-ep-sentinels-v2
7fe66827
qgallouedec Set the flag where the experts are sharded, and keep the router path …
e9f3a20c
qgallouedec Drop the dead default on _dispatch_routed_input
b22c3025
qgallouedec Fix NaN gradients in expert-parallel training: mask uninitialized gro…
8af1a002
qgallouedec Fix wrong gradients for all non-expert parameters in expert-parallel …
1f0b7bf6
qgallouedec Trim comments
4636d425
qgallouedec Gate the router-score backward all-reduce on grad mode; drop the post…
89fa55ca
qgallouedec Fix expert parallelism through Trainer (#48208)
96769d99
qgallouedec Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh
c74c1228
qgallouedec Gather the sharded state dict through the model's own save helpers
1c66acbc
qgallouedec Document combining expert parallelism with FSDP2
38aefbf2
qgallouedec Address review: drop the dead expert-gradient sync, torch-native mixe…
e72b117d
qgallouedec Give each device mesh its own optimizer param group instead of steppi…
449acd21
qgallouedec Test the 2-D mesh with a batch split across the fsdp ranks and compar…
9d17bd7a
qgallouedec Refresh the throughput table
6f2d9c4b
qgallouedec Cosmetic: docstring layout, comment placement, doc link
3a8da119
qgallouedec Expert-parallel token dispatch: each rank trains on its own part of t…
1b071993
qgallouedec Make the dispatch handling of the experts explicit in apply_fully_sha…
7063c456
qgallouedec Combine the dispatched expert outputs in the routing weights' precisi…
dc1fdeee
qgallouedec Split the batches across every rank with a DistributedSampler under t…
f2a3c26d
qgallouedec Simplify the dispatch: torch's differentiable all-to-all, the grouped…
3ab94ff1
qgallouedec Dispatch as plan-level styles; one notion of the ranks sharing a batc…
d1881444
qgallouedec Select the dispatch styles in the mixin, guard the torch version and …
b9bf58bd
qgallouedec Rewrite the expert parallel plan the model actually reads for the dis…
39cdce50
qgallouedec Seed the dispatch sampler with data_seed; require the grouped_mm expe…
9f862308
qgallouedec Run the local experts directly: the grouped forward's masking and com…
930c146a
qgallouedec Run the local experts through the module's own forward
15588e00
qgallouedec Dispatch: one host sync per layer, comments say what the code does
51f281d9
qgallouedec Dispatch: drop the router style, reuse the named mesh and is_dtensor,…
101bfea9
qgallouedec Dispatch: skip the mixin tests for models without an FSDP plan, drop …
2d9046bd
qgallouedec Fix the _has_fsdp_plan docstring
42606afb
qgallouedec Drop the FSDP plan skip from the mixin tests: every config carries a …
d8eb1fc1
qgallouedec Format
23920e3a
qgallouedec Keep the base install_forward signature on the dispatch experts style
e1498696
qgallouedec Docs: shorter token dispatch overview
e139e8a5
qgallouedec Replicate the rest of the plan under expert parallel token dispatch
cf74929d
qgallouedec Merge remote-tracking branch 'upstream/main' into fsdp2-ep-2d-mesh
0e21b598
qgallouedec Narrow to the RoPE permutation, leave transposes to shard-on-read
f4562cf1
qgallouedec Merge branch 'main' into load-convert-before-shard
d8c8613a
qgallouedec Merge branch 'main' into load-convert-before-shard
7d960108
qgallouedec Merge branch 'fsdp2-ep-2d-mesh' into ep-token-dispatch
18144abb
qgallouedec Update docs/source/en/expert_parallelism.md
c9a42167
qgallouedec Test the byte spans a rank warms
e21db3dc
qgallouedec Make local ranks pick the same prefetch plan
20896a7b
qgallouedec Reduce over the accelerator the file already binds to
b191be0e
qgallouedec Merge branch 'main' into load-shard-prefetch
19f7ae1d
qgallouedec Update docs/source/en/expert_parallelism.md
8f2f9cb1
qgallouedec Update docs/source/en/expert_parallelism.md
3c8f600e
qgallouedec Update docs/source/en/expert_parallelism.md
e7be30a9
qgallouedec Update docs/source/en/expert_parallelism.md
8dbccad4
qgallouedec Merge branch 'main' into load-shard-prefetch
9f432f54
qgallouedec Bind the prefetch barrier to the accelerator
9e8a65d2
qgallouedec Merge branch 'load-shard-prefetch' into prefetch-rank-spans
82a4f5ba
qgallouedec Merge branch 'main' into load-convert-before-shard
717a3a95
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
f436d9b4
qgallouedec Merge branch 'main' into fsdp2-ep-2d-mesh
35ed430b
qgallouedec Merge remote-tracking branch 'upstream/main' into moe-skip-ep-sentine…
1103b0ec
qgallouedec Merge branch 'fsdp2-ep-2d-mesh' into ep-token-dispatch
79fe11d4
qgallouedec Merge branch 'main' into qwen3_vl_moe_tp_plan
298ffa4d
qgallouedec Merge remote-tracking branch 'upstream/main' into umb48204
3e6e8755
qgallouedec Merge branch 'pr48516' into umb48204
82e8fca8
qgallouedec Merge branch 'pr48201' into umb48204
a8916bef
qgallouedec Merge branch 'pr48227' into umb48204
55b35321
qgallouedec Merge branch 'pr48237' into umb48204
4460294e
qgallouedec Merge branch 'pr48519' into umb48204
43a10a22
qgallouedec Merge branch 'pr48518' into umb48204
b3119027
qgallouedec Drop the HF_EP_DISPATCH prototype call sites superseded by #48518
b89b0e67
qgallouedec Merge branch 'pr48373' into umb48204
fba560cb
qgallouedec Keep replicated_with_grad_allreduce under expert-parallel dispatch
c8d3107f
qgallouedec Keep replicated_with_grad_allreduce under expert-parallel dispatch
0817429f
qgallouedec Compare gradients, not only the loss, in the EP backward test
34e63c9d
qgallouedec Merge branch 'pr48518' into umb48204
caac0ad5
qgallouedec Merge branch 'main' into ep-fsdp-2d-mesh
fccd0e7f
qgallouedec Merge branch 'main' into load-convert-before-shard
5892c331
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
7b09389e
qgallouedec Warm the page cache before sharded loading (opt-in via HF_SHARD_PREFE…
153a3994
qgallouedec style
cf674aa3
qgallouedec Move the shard prefetch into distributed/utils.py
77ad02d0
qgallouedec Apply ruff format to the prefetch helper
70c6ac4b
qgallouedec Bind the prefetch barrier to the accelerator
f70364f3
qgallouedec Merge branch 'main' into moe-skip-ep-sentinels-v2
e3e2d58d
qgallouedec Update docs/source/en/expert_parallelism.md
75fff716
qgallouedec Update docs/source/en/expert_parallelism.md
acba6bc9
qgallouedec Update docs/source/en/expert_parallelism.md
69668c3c
qgallouedec Update docs/source/en/expert_parallelism.md
9cfb2d3b
qgallouedec Merge branch 'main' into fsdp2-ep-2d-mesh
2884e2f1
qgallouedec Merge branch 'main' into qwen3_vl_moe_tp_plan
86fc3945
qgallouedec Merge branch 'fsdp2-ep-2d-mesh' into ep-token-dispatch
4ce47004
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into pref…
a687e4da
qgallouedec Flag the empty shard in set_param_for_module
fee68450
qgallouedec Only build the sharding op when it is used
cb61b1aa
qgallouedec Declare dispatch_experts_forward next to its only caller
28cb4827
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
f22f18a7
qgallouedec Let each op say whether it breaks shard-on-read
071db775
qgallouedec Merge branch 'main' into load-convert-before-shard
5fa9a03d
qgallouedec Warm the page cache before sharded loading (opt-in via HF_SHARD_PREFE…
11bca8c0
qgallouedec style
04bedbe5
qgallouedec Move the shard prefetch into distributed/utils.py
8c873dc2
qgallouedec Apply ruff format to the prefetch helper
2a42ab85
qgallouedec Bind the prefetch barrier to the accelerator
31a256b5
qgallouedec Name the dispatch strategy instead of switching it with a bool
a6e36c09
qgallouedec Merge branch 'main' into moe-skip-ep-sentinels-v2
70bd69ef
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into umb4…
ad3b02ff
qgallouedec Merge remote-tracking branch 'upstream/prefetch-rank-spans' into umb4…
9505dee1
qgallouedec Merge remote-tracking branch 'upstream/moe-skip-ep-sentinels-v2' into…
bbf73973
qgallouedec Merge remote-tracking branch 'upstream/fix-empty-fsdp-shards' into um…
18ef7f71
qgallouedec Merge remote-tracking branch 'upstream/fsdp2-ep-2d-mesh' into umb48204
6a207528
qgallouedec Merge remote-tracking branch 'upstream/ep-token-dispatch' into umb48204
7683dddb
qgallouedec Merge remote-tracking branch 'upstream/load-convert-before-shard' int…
b669fc20
qgallouedec Warm the page cache before sharded loading (opt-in via HF_SHARD_PREFE…
6e40b0b1
qgallouedec style
9a61e7b7
qgallouedec Move the shard prefetch into distributed/utils.py
e8b13c27
qgallouedec Apply ruff format to the prefetch helper
eed24d1e
qgallouedec Bind the prefetch barrier to the accelerator
a98cde20
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
758ed92f
qgallouedec Merge branch 'main' into fsdp2-ep-2d-mesh
1be3a7f5
qgallouedec Merge branch 'main' into load-convert-before-shard
10f60888
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into pref…
62e85eab
qgallouedec Warm the page cache before sharded loading (opt-in via HF_SHARD_PREFE…
72548d08
qgallouedec style
dd8804bd
qgallouedec Move the shard prefetch into distributed/utils.py
acae96cf
qgallouedec Apply ruff format to the prefetch helper
7db2467b
qgallouedec Bind the prefetch barrier to the accelerator
68bc14bf
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into pref…
e514c7fd
qgallouedec Merge branch 'main' into load-convert-before-shard
14fe0333
qgallouedec Merge remote-tracking branch 'upstream/fsdp2-ep-2d-mesh' into ep-toke…
db788602
qgallouedec Merge branch 'main' into fsdp2-ep-2d-mesh
a6f5824a
qgallouedec Warm the page cache before sharded loading (opt-in via HF_SHARD_PREFE…
5489cde1
qgallouedec style
0b5d4402
qgallouedec Move the shard prefetch into distributed/utils.py
170161c5
qgallouedec Apply ruff format to the prefetch helper
2f54f17c
qgallouedec Bind the prefetch barrier to the accelerator
a1846bc2
qgallouedec Merge branch 'main' into fix-empty-fsdp-shards
d9183573
qgallouedec Merge branch 'fsdp2-ep-2d-mesh' into ep-token-dispatch
b56e1d68
qgallouedec Merge branch 'main' into load-convert-before-shard
65b6e406
qgallouedec Merge branch 'main' into qwen3_vl_moe_tp_plan
6fbcb300
qgallouedec Merge remote-tracking branch 'upstream/main' into umb48204
dc7143f5
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into umb4…
a58566db
qgallouedec Merge remote-tracking branch 'upstream/prefetch-rank-spans' into umb4…
56699c82
qgallouedec Merge remote-tracking branch 'upstream/fsdp2-ep-2d-mesh' into umb48204
fef0435d
qgallouedec Merge remote-tracking branch 'upstream/ep-token-dispatch' into umb48204
21e12768
qgallouedec Merge remote-tracking branch 'upstream/fix-empty-fsdp-shards' into um…
cfc7f175
qgallouedec Merge branch 'pr48373-head' into umb48204
d12ff1fb
qgallouedec Merge remote-tracking branch 'upstream/load-convert-before-shard' int…
2a7a88d6
qgallouedec Merge branch 'main' into fsdp2-ep-2d-mesh
cb02b27f
qgallouedec Pass the ignored params through the policy helper
6a86e181
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into pref…
37c8ee6f
qgallouedec Merge remote-tracking branch 'upstream/main' into fsdp2-ep-2d-mesh
79988c35
qgallouedec Drop the comment on the parallel sizes
51207488
qgallouedec Trim the parallelism config comment
0147840f
qgallouedec Warm the page cache before sharded loading (opt-in via HF_SHARD_PREFE…
b1744994
qgallouedec style
48ce8e26
qgallouedec Move the shard prefetch into distributed/utils.py
3e51ffbc
qgallouedec Apply ruff format to the prefetch helper
ef758c4e
qgallouedec Bind the prefetch barrier to the accelerator
cfdc8bab
qgallouedec Merge remote-tracking branch 'upstream/fsdp2-ep-2d-mesh' into ep-toke…
d604a2a2
qgallouedec Merge remote-tracking branch 'upstream/main' into ep-token-dispatch
b169a75d
qgallouedec Address review: guard dispatch + PP, derive the mesh name, move the g…
3439765f
qgallouedec Keep reading the tensor parallel size from accelerate in `get_tp_size`
4f2a6b91
qgallouedec Give the token dispatch weight comparison its own tolerance
86561b69
3outeille Separate expert dispatch mesh from tensor parallel size
df8fa771
3outeille Support trunk tensor parallelism with folded expert dispatch
60655f89
3outeille rm config test
d7753400
3outeille Simplify expert dispatch and rename edp to efsdp
a49aa6d1
3outeille Merge branch 'ep-token-dispatch' into ep-mesh
b1fdbdf3
3outeille Merge origin/ep-mesh and restore expert-parallel mesh support
6d8f54de
3outeille Unify dense and expert mesh construction
ea65cfb3
3outeille remove
b33e45e0
3outeille Encapsulate distributed mesh views behind named accessors
0eb9ffa8
3outeille Simplify MeshManager access and keep mesh views private
4d63a32c
3outeille Simplify expert parallel configuration and explicit plan selection
d4da6e0b
3outeille Resolve TP and EP plans before sharding and derive expert dispatch
6a1059ee
3outeille Merge branch 'main' into ep-token-dispatch
56047f4c
3outeille Merge branch 'ep-token-dispatch' into ep-mesh
00717373
3outeille Inline legacy expert parallel compatibility handling
c8a05bc6
3outeille Simplify parallel plan resolution and clarify TP and EP meshes
cc2237c5
3outeille remove
fc37645e
3outeille Remove auto EP plans and clarify parallel plan tests
251b2b94
3outeille Clarify expert parallel docs and explicit sharding mesh selection
8c2588da
3outeille Always wrap dispatched experts on the expert FSDP mesh
19118585
3outeille Clarify TP and EP layouts in FSDP comparison test
49f432cd
3outeille Clarify all-reduce and dispatch layouts in EP tests
6d231256
3outeille Take TP and EP meshes in apply_tensor_parallelism
e1d33d25
3outeille add default all-to-all plan for qwen3_moe only + derive rule from pl…
79fe4a43
3outeille raise in `resolve_parallel_plans` when an override key matches no mod…
2dc99524
3outeille better distinguish masked/all-to-all path for nicer API
b2b0d324
qgallouedec Merge remote-tracking branch 'upstream/ep-mesh' into ep-umbrella
45ad8d1e
qgallouedec Merge remote-tracking branch 'upstream/load-shard-prefetch' into ep-u…
6e4964ff
qgallouedec Merge remote-tracking branch 'upstream/prefetch-rank-spans' into ep-u…
092a8e31
qgallouedec Trainer: average the gradients of parameters FSDP2 does not shard
f4582493
qgallouedec Trainer: broadcast the parameters FSDP2 does not shard before training
9d0eb661
qgallouedec Style
65781c6e
qgallouedec Merge branch 'ep-umbrella' into ep-fsdp-2d-mesh
36ec32db
qgallouedec Drop #48237, #48519 and #48373 from the umbrella
ee8ecdf0
github-actions
github-actions
qgallouedec qgallouedec changed the title [Umbrella] Enable FSDP2 + expert parallelism via a 2-D (fsdp, tp) device mesh [Umbrella] FSDP2 + expert-parallel token dispatch, with sharded-loading prefetch 3 days ago

Login to write a write a comment.

Login via GitHub

Reviewers
No reviews
Assignees
Labels
Milestone