run.sh 1.5 KB
Newer Older
Y
Yibing Liu 已提交
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
export CUDA_VISIBLE_DEVICES=4
export FLAGS_eager_delete_tensor_gb=0.0

#pretrain
python -u main.py \
  --do_train True \
  --use_cuda \
  --save_path model_files_tmp/matching_pretrained \
  --train_path data/unlabel_data/train.ids \
  --val_path data/unlabel_data/val.ids

#finetune based on one task
TASK=human
python -u main.py \
  --do_train True \
  --loss_type L2 \
  --use_cuda \
  --save_path model_files_tmp/${TASK}_finetuned \
  --init_model model_files/matching_pretrained \
  --train_path data/label_data/$TASK/train.ids \
  --val_path data/label_data/$TASK/val.ids \
  --print_step 1 \
  --save_step 1 \
  --num_scan_data 50 

#evaluate pretrained model by Recall
python -u main.py \
  --do_val True \
  --use_cuda \
  --test_path data/unlabel_data/test.ids \
  --init_model model_files/matching_pretrained \
  --loss_type CLS

#evaluate pretrained model by Cor
for task in seq2seq_naive seq2seq_att keywords human
do
  echo $task
  python -u main.py \
    --do_val True \
    --use_cuda \
    --test_path data/label_data/$task/test.ids \
    --init_model model_files/matching_pretrained \
    --loss_type L2
done

#evaluate finetuned model by Cor
for task in seq2seq_naive seq2seq_att keywords human
do
  echo $task
  python -u main.py \
    --do_val True \
    --use_cuda \
    --test_path data/label_data/$task/test.ids \
    --init_model model_files/${task}_finetuned \
    --loss_type L2 
done
  
#infer
TASK=human
python -u main.py \
  --do_infer True \
  --use_cuda \
  --test_path data/label_data/$TASK/test.ids \
  --init_model model_files/${TASK}_finetuned