Spaces:
Runtime error
Runtime error
File size: 3,731 Bytes
50f0fbb |
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
#!/bin/bash
#SBATCH --job-name=randeng_pegasus_523M_summary
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --gres=gpu:8 # number of gpus
#SBATCH --cpus-per-task=30
#SBATCH -o %x-%j.log
set -x -e
echo "START TIME: $(date)"
MODEL_NAME=randeng_pegasus_523M_summary_last
MICRO_BATCH_SIZE=128
ROOT_DIR=/cognitive_comp/dongxiaoqun/finetune/${MODEL_NAME}
if [ ! -d ${ROOT_DIR} ];then
mkdir ${ROOT_DIR}
echo ${ROOT_DIR} created!!!!!!!!!!!!!!
else
echo ${ROOT_DIR} exist!!!!!!!!!!!!!!!
fi
output_save_path=$ROOT_DIR/${MODEL_NAME}.json
if [ -f ${output_save_path} ];then
echo ${output_save_path} exist, rm it!!!!!!!!!!!!!!!!!
rm ${output_save_path}
fi
ZERO_STAGE=1
config_json="${ROOT_DIR}/ds_config.${MODEL_NAME}.json"
# Deepspeed figures out GAS dynamically from dynamic GBS via set_train_batch_size()
cat <<EOT > $config_json
{
"train_micro_batch_size_per_gpu": ${MICRO_BATCH_SIZE},
"steps_per_print": 1000,
"gradient_clipping": 1.0,
"zero_optimization": {
"stage": $ZERO_STAGE,
"contiguous_gradients": false,
"overlap_comm": true,
"reduce_scatter": true,
"reduce_bucket_size": 50000000,
"allgather_bucket_size": 500000000
},
"optimizer": {
"type": "Adam",
"params": {
"lr": 5e-5,
"betas": [
0.9,
0.999
],
"eps": 1e-8,
"weight_decay": 1e-2
}
},
"scheduler": {
"params": {
"warmup_min_lr": 1e-8,
"warmup_max_lr": 1e-4,
"total_num_steps": 60000,
"warmup_num_steps" : 1000
},
"type": "WarmupDecayLR"
},
"zero_allow_untested_optimizer": false,
"fp16": {
"enabled": true,
"loss_scale": 0,
"loss_scale_window": 1000,
"hysteresis": 2,
"min_loss_scale": 1
},
"activation_checkpointing": {
"partition_activations": false,
"contiguous_memory_optimization": false
},
"wall_clock_breakdown": false
}
EOT
export PL_DEEPSPEED_CONFIG_PATH=$config_json
export TORCH_EXTENSIONS_DIR=/cognitive_comp/dongxiaoqun/torch_extendsions
# export MASTER_PORT=$[RANDOM%10000+50000]
#
# --strategy deepspeed_stage_${ZERO_STAGE} \
TRAINER_ARGS="
--max_epochs 10 \
--gpus 1 \
--num_nodes 1 \
--strategy deepspeed_stage_${ZERO_STAGE} \
--default_root_dir $ROOT_DIR \
--dirpath $ROOT_DIR/ckpt \
--save_top_k 3 \
--monitor val_loss \
--mode min \
--save_last \
--every_n_train_steps 10000 \
--val_check_interval 0.1 \
"
prompt='"'
DATA_ARGS="
--datasets_name lcsts \
--num_workers 30 \
--train_batchsize $MICRO_BATCH_SIZE \
--val_batchsize $MICRO_BATCH_SIZE \
--test_batchsize $MICRO_BATCH_SIZE \
--max_enc_length 128 \
--max_dec_length 64 \
--val_datasets_field val \
--prompt $prompt \
"
# --prompt $prompt \
# --pretrained_model_path /cognitive_comp/ganruyi/experiments/randeng_t5_77M_summary/ckpt/hf_pretrained_epoch1_step75019 \
# mode_path="/cognitive_comp/dongxiaoqun/train_model/fengshen-pegasus-base/ckpt/hf_pretrained_epoch0_step22200/"
mode_path="/cognitive_comp/dongxiaoqun/train_model/fengshen-pegasus-large/ckpt/hf_pretrained_epoch0_step122000"
cp /cognitive_comp/dongxiaoqun/pretrained_model/pegasus-large/vocab.txt $mode_path/
MODEL_ARGS="
--pretrained_model_path $mode_path \
--output_save_path $output_save_path \
--self_tokenizer \
"
SCRIPTS_PATH=/cognitive_comp/dongxiaoqun/debug/Fengshenbang-LM/fengshen/examples/summary/seq2seq_summary.py
export CMD=" \
$SCRIPTS_PATH \
$TRAINER_ARGS \
$MODEL_ARGS \
$DATA_ARGS \
"
echo $CMD
source activate
conda activate torchnew
srun --nodes=1 --ntasks-per-node=1 --gres=gpu:1 --cpus-per-task=30 -o ${MODEL_NAME}-%J.log --jobid=229555 bash -c 'python3 $SCRIPT_PATH $CMD'
|