modelscope--ms-swift
43 行
1.4 KiB
Bash
43 行
1.4 KiB
Bash
# ZeRO3: 91.2s/it; 16 * 80GiB
|
|
# Megatron-LM: 9.6s/it; 16 * 60GiB
|
|
# Launch using Alibaba Cloud DLC
|
|
# https://help.aliyun.com/zh/pai/user-guide/general-environment-variables
|
|
# ref: https://github.com/modelscope/ms-swift/blob/main/examples/train/multi-node/dlc/train.sh
|
|
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True' \
|
|
NNODES=$WORLD_SIZE \
|
|
NODE_RANK=$RANK \
|
|
megatron sft \
|
|
--model Qwen/Qwen3-30B-A3B-Base \
|
|
--save_safetensors true \
|
|
--dataset 'liucong/Chinese-DeepSeek-R1-Distill-data-110k-SFT' \
|
|
--load_from_cache_file true \
|
|
--split_dataset_ratio 0.01 \
|
|
--pipeline_model_parallel_size 2 \
|
|
--expert_model_parallel_size 8 \
|
|
--moe_permute_fusion true \
|
|
--moe_grouped_gemm true \
|
|
--moe_shared_expert_overlap true \
|
|
--moe_aux_loss_coeff 1e-3 \
|
|
--micro_batch_size 1 \
|
|
--global_batch_size 16 \
|
|
--packing true \
|
|
--recompute_granularity full \
|
|
--recompute_method uniform \
|
|
--recompute_num_layers 1 \
|
|
--num_train_epochs 3 \
|
|
--finetune true \
|
|
--cross_entropy_loss_fusion true \
|
|
--lr 1e-5 \
|
|
--lr_warmup_fraction 0.05 \
|
|
--min_lr 1e-6 \
|
|
--output_dir megatron_output/Qwen3-30B-A3B-Base \
|
|
--eval_steps 200 \
|
|
--save_steps 200 \
|
|
--max_length 8192 \
|
|
--dataloader_num_workers 8 \
|
|
--dataset_num_proc 8 \
|
|
--no_save_optim true \
|
|
--no_save_rng true \
|
|
--sequence_parallel true \
|
|
--attention_backend flash
|