forked from NVIDIA/Megatron-LM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADLR/megatron-lm!1754 - MoE documentation refinement.
- Loading branch information
Showing
5 changed files
with
154 additions
and
50 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,19 @@ snapshot_download(repo_id="mistralai/Mixtral-8x7B-v0.1", ignore_patterns=["*.pt" | |
The HF checkpoints can be converted to Megatron format by using the provided checkpoint converter for HF format. | ||
The target model parallel size(e.g. TP,PP,EP) should be specified. | ||
|
||
Currently the converter doesn't support distributed checkpointing yet, so each different parallel config requires a specific checkpoint. | ||
- For training, the recommended model parallel config is TP1EP8PP4 | ||
- For inference, the recommended model parallel config is TP1EP1PP2 | ||
|
||
``` | ||
TOKENIZER_MODEL=/workspace/checkpoints/mixtral-hf/tokenizer.model | ||
MEGATRON_PATH="/workspace/megatron-lm" | ||
export PYTHONPATH=$MEGATRON_PATH:$PYTHONPATH | ||
export CUDA_DEVICE_MAX_CONNECTIONS=1 | ||
TARGET_TP_SIZE=1 | ||
TARGET_PP_SIZE=4 | ||
TARGET_EP_SIZE=8 | ||
TARGET_TP_SIZE="" | ||
TARGET_EP_SIZE="" | ||
TARGET_PP_SIZE="" | ||
HF_FORMAT_DIR=/workspace/checkpoints/mixtral-hf | ||
MEGATRON_FORMAT_DIR=/workspace/checkpoints/mixtral-mcore-TP${TARGET_TP_SIZE}PP${TARGET_PP_SIZE}EP${TARGET_EP_SIZE} | ||
|
@@ -88,6 +92,7 @@ torchrun $DISTRIBUTED_ARGS tools/run_text_generation_server.py \ | |
--num-experts 8 \ | ||
--moe-router-topk 2 \ | ||
--moe-token-dispatcher-type alltoall \ | ||
--moe-grouped-gemm \ | ||
--mock-data \ | ||
--rotary-base 1000000 | ||
``` | ||
|
@@ -119,6 +124,8 @@ docker run \ | |
bash examples/mixtral/train_mixtral_8x7b_distributed.sh $CHECKPOINT_PATH $TOKENIZER_MODEL $DATA_PATH | ||
``` | ||
|
||
The above functionality also applys to Mixtral 8x22B actually, you should set the model config (including hidden_size/head_num/num_layers/ffn_hidden_size) properly according to the original [config](https://huggingface.co/mistralai/Mixtral-8x22B-v0.1/blob/main/config.json). | ||
|
||
## Acknowledgements | ||
Contributors outside NVIDIA for the huggingface converter and example of Mixtral models in Megatron-Core: | ||
- Peng Li <[email protected]> | ||
|
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
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
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