forked from THUDM/CodeGeeX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_inference_parallel.sh
47 lines (39 loc) · 1.2 KB
/
test_inference_parallel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# This script is used to test the inference of CodeGeeX.
MP_SIZE=$1
PROMPT_FILE=$2
SCRIPT_PATH=$(realpath "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
MAIN_DIR=$(dirname "$SCRIPT_DIR")
TOKENIZER_PATH="$MAIN_DIR/codegeex/tokenizer/"
if [ -z "$MP_SIZE" ]; then
MP_SIZE=1
fi
if [ "$MP_SIZE" -eq 1 ]; then
source "$MAIN_DIR/configs/codegeex_13b.sh"
echo "Load config from $MAIN_DIR/configs/codegeex_13b.sh"
else
source "$MAIN_DIR/configs/codegeex_13b_parallel.sh"
echo "Load config from $MAIN_DIR/configs/codegeex_13b_parallel.sh"
fi
# export CUDA settings
export CUDA_HOME=/usr/local/cuda-11.1/
# export CUDA_VISIBLE_DEVICES=0,1
if [ -z "$PROMPT_FILE" ]; then
PROMPT_FILE=$MAIN_DIR/tests/test_prompt.txt
fi
# remove --greedy if using sampling
CMD="torchrun --nproc_per_node $MP_SIZE $MAIN_DIR/tests/test_inference_megatron.py \
--tensor-model-parallel-size $MP_SIZE \
--prompt-file $PROMPT_FILE \
--tokenizer-path $TOKENIZER_PATH \
--micro-batch-size 1 \
--out-seq-length 1024 \
--temperature 0.8 \
--top-p 0.95 \
--top-k 0 \
--greedy \
--use-cpu-initialization \
--ln-fp16 \
$MODEL_ARGS"
echo "$CMD"
eval "$CMD"