Add ep_size to ParallelismConfig so FSDP2 can compose with expert parallelism - #4202
Open
YeonwooSung wants to merge 1 commit into
Open
Add ep_size to ParallelismConfig so FSDP2 can compose with expert parallelism#4202YeonwooSung wants to merge 1 commit into
YeonwooSung wants to merge 1 commit into
Conversation
Expert parallelism is a first-class mesh dimension. FSDP2 still shards non-expert parameters on dp_shard(+cp); the model places expert weights on the ep submesh. Accelerate does not implement token dispatch. Fixes huggingface#4200
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.
What does this PR do?
ParallelismConfighaddp_replicate,dp_shard,tp,cp, andsp, but no expert-parallel axis. A 2-way FSDP 脳 4-way EP layout on 8 GPUs could not be expressed, and every downstream stack had to invent its own mesh.This adds
ep_size(envPARALLELISM_CONFIG_EP_SIZE, CLI--parallelism_config_ep_size,accelerate configwhen FSDP2 parallelism is enabled). Default is1.total_sizeandnon_data_parallel_sizeincludeep_size"ep"is innon_dp_dim_nameswhenep_size > 1(same batch on every EP rank, like TP/CP)"ep"is not infsdp_dim_names/dp_shard_cp_dim_names, so FSDP2 does not double-shard expert weightsdp_replicate,dp_shard,cp,sp,ep,tp(only enabled dims appear)prepare_data_loadertreats EP like TP/CP when mapping ranks onto data-parallel groupsExpert placement stays with the model. Accelerate only builds
accelerator.torch_device_mesh["ep"].Fixes #4200. Config/mesh half of the FSDP2 脳 EP work around #4178 / huggingface/transformers#48204 / huggingface/trl#6869.
Not in this PR: token-choice dispatch, FSDP2 wrap-heuristic changes, USP (CP+SP).
Tests
PARALLELISM_CONFIG_EP_SIZEep_size=0raisesep_size=1does not change existing CP/TP meshesdp_replicate>1+ep>1is allowedWho can review?
@SunMarc @qgallouedec