-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mixture of Experts Training with Acceleration Library Plugin #69
Conversation
This file contains 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
736d3c1
to
078e737
Compare
51499ff
to
b036263
Compare
75bded5
to
f945f59
Compare
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Merged
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
1b6d7a7
to
01fa69a
Compare
Signed-off-by: Yu Chin Fabian Lim <flim@sg.ibm.com>
6 tasks
superceeded by #99 |
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.
This PR adds a plug in for mixture of experts training, combining FSDP with expert parallel where the latter is borrowed from databricks megablocks
This implements the FSDP1 version of expert parallel from https://github.com/foundation-model-stack/moe-distributed-training
What is Expert Parallel?
Expert parallel is a form of model parallelism that applies to mixture-of-experts models.
Diagram of Data Parallel (e.g., FSDP) vs Expert Parallel
Performance
Benchmark Results
Full-Finetuning
torch.bfloat16
training, no mixed-precisionmem_peak
mem_alloc
train_runtime
mem
improvementruntime
improvementNOTE: the train runtimes were collected with
--skip_memory_metrics=True
(huggingface default); setting this toFalse
was only used to benchmark memory numbers, as is known to result in worser runtime measurementsNOTE: throughput numbers were 83 and 337 tokens per second, respectively.
Checkpoint Resumption
Checkpointing works as evidenced by correct training resumption behavior (see below):
DTensor
sharding.Next steps
Implementation Details
Comparison with DeepSpeed MoE (DS-MoE)
Deepspeed also has support for mixture-of-expert sharding. Noting down some points here:
stage3
when also sharding MoE; this means that the non-MoE parameters cannot be parameter-sharded.split_params_into_different_moe_groups_for_optimizer
. This call is not integrated into accelerate's_prepare_deepspeed
function.Updates to
benchmark.py
We now also
framework_config
entry to allow the scenario to include the "no acceleration" case in the matrix:slow
tag, that if true, then we ignore the scenario in unfiltered runs.accelerator-config.json
to pass arguments toAccelerator
, for example to set thesync_each_batch
flag.Checklist of items covered
torch.distributed.dcp
is operating correctly,.Known Issues
torch.concat
operation is dominating theload_sharded_experts_onto_device
function.concat
all the expert weights and then pass totorch.distributed
to shard it