-
Notifications
You must be signed in to change notification settings - Fork 326
/
finetune_superglue.sh
39 lines (34 loc) · 1.12 KB
/
finetune_superglue.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
DATA_ROOT=/dataset/fd5061f6/english_data/superglue
CHECKPOINT_PATH=/dataset/fd5061f6/pretrained_models
SAVE_PATH=/dataset/fd5061f6/finetune_checkpoints
source $1 # Model
source $2 # Task
if [ -z $N_GPU ];then
N_GPU=1
fi
MASTER_PORT=$(shuf -n 1 -i 10000-65535)
DISTRIBUTED_ARGS="--nproc_per_node ${N_GPU} --nnodes 1 --node_rank 0 --master_addr localhost --master_port $MASTER_PORT"
PER_GPU_BS=$(($BATCH_SIZE/$N_GPU))
DATESTR=$(date +"%m-%d-%H-%M")
EXPERIMENT_NAME=${EXPERIMENT_NAME}-${DATESTR}
mkdir logs
python -m torch.distributed.launch $DISTRIBUTED_ARGS finetune_glm.py \
--finetune \
--cloze-eval \
--experiment-name ${EXPERIMENT_NAME} \
--task ${TASK_NAME} \
--data-dir ${DATA_PATH} \
--save ${SAVE_PATH} \
--seq-length ${MAX_SEQ_LEN} \
--checkpoint-activations \
--eval-batch-size 16 \
--save-epoch 100000 \
$MODEL_ARGS \
$TRAIN_ARGS \
$COMMON_ARGS \
--fp16 \
--batch-size ${PER_GPU_BS} \
--epochs ${EPOCH_SINGLE} \
--lr ${LR_SINGLE} \
--overwrite \
2>&1 | tee logs/log-${EXPERIMENT_NAME}.txt