ModelLink2/examples/legacy/llama2/chat_llama2_70b_ptd.sh
guoxinjie 670f729060 !1760 整理主线分支 README
Merge pull request !1760 from guoxinjie/arrange_readme
2024-10-25 01:33:31 +00:00

59 lines
1.8 KiB
Bash

#!/bin/bash
export CUDA_DEVICE_MAX_CONNECTIONS=1
# please fill these path configurations
CHECKPOINT="your model directory path"
TOKENIZER_PATH="your tokenizer directory path"
TOKENIZER_MODEL="your tokenizer.model file path"
# Change for multinode config
MASTER_ADDR=localhost
MASTER_PORT=6001
NNODES=1
NODE_RANK=0
NPUS_PER_NODE=8
DISTRIBUTED_ARGS="--nproc_per_node $NPUS_PER_NODE --nnodes $NNODES --node_rank $NODE_RANK --master_addr $MASTER_ADDR --master_port $MASTER_PORT"
python -m torch.distributed.launch $DISTRIBUTED_ARGS inference.py \
--tensor-model-parallel-size 8 \
--pipeline-model-parallel-size 1 \
--task chat \
--hf-chat-template \
--add-eos-token '<|eot_id|>' \
--top-p 0.9 \
--temperature 1 \
--num-layers 32 \
--num-layers 80 \
--hidden-size 8192 \
--ffn-hidden-size 28672 \
--position-embedding-type rope \
--seq-length 4096 \
--max-new-tokens 256 \
--micro-batch-size 1 \
--num-attention-heads 64 \
--max-position-embeddings 4096 \
--swiglu \
--load "${CHECKPOINT}" \
--tokenizer-type PretrainedFromHF \
--tokenizer-name-or-path "${TOKENIZER_PATH}" \
--tokenizer-model "${TOKENIZER_MODEL}" \
--tokenizer-not-use-fast \
--fp16 \
--group-query-attention \
--num-query-groups 8 \
--normalization RMSNorm \
--untie-embeddings-and-output-weights \
--disable-bias-linear \
--attention-softmax-in-fp32 \
--no-load-optim \
--no-load-rng \
--no-masked-softmax-fusion \
--no-gradient-accumulation-fusion \
--exit-on-missing-checkpoint \
--make-vocab-size-divisible-by 1 \
--use-kv-cache \
--use-flash-attn \
| tee logs/chat_llama2_70b.log