46 Star 317 Fork 406

Ascend/MindSpeed

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
pretrain_llama.sh 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
邓佳 提交于 11个月前 . !384change GPU to NPU
#!/bin/bash
source "tests_extend/system_tests/env_npu.sh"
export CUDA_DEVICE_MAX_CONNECTIONS=1
NPUS_PER_NODE=8
# Change for multinode config
MASTER_ADDR=localhost
MASTER_PORT=6000
NNODES=1
NODE_RANK=0
WORLD_SIZE=$(($NPUS_PER_NODE*$NNODES))
CKPT_DIR=./ckpt_llama
DATA_PATH="/home/dataset/llama2/alpaca_text_document"
TOKENIZER_MODEL="/home/dataset/model/llama-2-7b-hf/tokenizer.model"
TP=2
PP=4
DISTRIBUTED_ARGS="
--nproc_per_node $NPUS_PER_NODE \
--nnodes $NNODES \
--node_rank $NODE_RANK \
--master_addr $MASTER_ADDR \
--master_port $MASTER_PORT
"
GPT_ARGS="
--tensor-model-parallel-size ${TP} \
--pipeline-model-parallel-size ${PP} \
--num-layers-per-virtual-pipeline-stage 2 \
--no-overlap-p2p-communication \
--no-delay-grad-reduce \
--delay-param-gather \
--no-scatter-gather-tensors-in-pipeline \
--sequence-parallel \
--num-layers 16 \
--hidden-size 4096 \
--ffn-hidden-size 11008 \
--num-attention-heads 32 \
--tokenizer-type Llama2Tokenizer \
--tokenizer-model ${TOKENIZER_MODEL} \
--no-load-optim \
--no-load-rng \
--seq-length 4096 \
--max-position-embeddings 4096 \
--micro-batch-size 4 \
--global-batch-size 32 \
--make-vocab-size-divisible-by 1 \
--lr 1.25e-6 \
--train-iters 20 \
--lr-decay-style cosine \
--untie-embeddings-and-output-weights \
--disable-bias-linear \
--attention-dropout 0.0 \
--init-method-std 0.01 \
--hidden-dropout 0.0 \
--use-rotary-position-embeddings \
--normalization RMSNorm \
--use-fused-rmsnorm \
--swiglu \
--no-position-embedding \
--no-masked-softmax-fusion \
--attention-softmax-in-fp32 \
--min-lr 1.25e-7 \
--eval-iters 0 \
--weight-decay 1e-1 \
--lr-warmup-fraction 0.01 \
--clip-grad 1.0 \
--adam-beta1 0.9 \
--adam-beta2 0.95 \
--adam-eps 1e-8 \
--norm-epsilon 1e-5 \
--rotary-percent 1 \
--hysteresis 2 \
--initial-loss-scale 65536 \
--min-loss-scale 1
--loss-scale-window 1000 \
--use-flash-attn \
--no-gradient-accumulation-fusion \
--bf16
"
DATA_ARGS="
--data-path $DATA_PATH \
--split 100,0,0
"
OUTPUT_ARGS="
--log-interval 1 \
--save-interval 10 \
--eval-interval 10 \
--eval-iters 10 \
"
torchrun $DISTRIBUTED_ARGS pretrain_gpt.py \
$GPT_ARGS \
$DATA_ARGS \
$OUTPUT_ARGS \
--distributed-backend nccl \
--load $CKPT_DIR \
--finetune \
--exit-on-missing-checkpoint \
--use-checkpoint-args \
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ascend/MindSpeed.git
git@gitee.com:ascend/MindSpeed.git
ascend
MindSpeed
MindSpeed
1.0.RC1

搜索帮助