From 713a423e4d74a16def79e21418639accfb1527e7 Mon Sep 17 00:00:00 2001 From: WANG Yue <337111657@qq.com> Date: Wed, 15 Sep 2021 21:20:38 +0800 Subject: [PATCH] Update exp_with_args.sh --- sh/exp_with_args.sh | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/sh/exp_with_args.sh b/sh/exp_with_args.sh index 8fd700e..b2faed6 100644 --- a/sh/exp_with_args.sh +++ b/sh/exp_with_args.sh @@ -1,7 +1,4 @@ -export HF_DATASETS_CACHE="/export/share/wang.y/workspace/cache_data" -export TRANSFORMERS_CACHE="/export/share/wang.y/workspace/cache_model" -export XDG_CACHE_HOME="/export/share/wang.y/workspace/cache_model" -export WORKDIR="/export/share/wang.y/workspace/CodeT5_release" +WORKDIR="path_to_your_dir/CodeT5" export PYTHONPATH=$WORKDIR TASK=${1} @@ -16,11 +13,9 @@ TRG_LEN=${9} PATIENCE=${10} EPOCH=${11} WARMUP=${12} -GPU_TYPE=${13} - -RES_FN=${14} - -MODEL_PATH='/export/share/wang.y/workspace/CodeT5_release/pretrained_models' +MODEL_DIR=${13} +SUMMARY_DIR=${14} +RES_FN=${15} if [[ $DATA_NUM == -1 ]]; then DATA_TAG='all' @@ -32,9 +27,9 @@ fi FULL_MODEL_TAG=${MODEL_TAG}_${DATA_TAG}_lr${LR}_bs${BS}_src${SRC_LEN}_trg${TRG_LEN}_pat${PATIENCE}_e${EPOCH} if [[ ${SUB_TASK} == none ]]; then - OUTPUT_DIR=saved_models/${TASK}/${FULL_MODEL_TAG} + OUTPUT_DIR=${MODEL_DIR}/${TASK}/${FULL_MODEL_TAG} else - OUTPUT_DIR=saved_models/${TASK}/${SUB_TASK}/${FULL_MODEL_TAG} + OUTPUT_DIR=${MODEL_DIR}/${TASK}/${SUB_TASK}/${FULL_MODEL_TAG} fi CACHE_DIR=${OUTPUT_DIR}/cache_data @@ -47,23 +42,19 @@ mkdir -p ${RES_DIR} if [[ $MODEL_TAG == roberta ]]; then MODEL_TYPE=roberta TOKENIZER=roberta-base - MODEL_NAME=roberta-base + MODEL_PATH=roberta-base elif [[ $MODEL_TAG == codebert ]]; then MODEL_TYPE=roberta TOKENIZER=roberta-base - MODEL_NAME=microsoft/codebert-base -elif [[ $MODEL_TAG == bart_base ]]; then - MODEL_TYPE=bart - TOKENIZER=facebook/bart-base - MODEL_NAME=facebook/bart-base + MODEL_PATH=microsoft/codebert-base elif [[ $MODEL_TAG == codet5_small ]]; then MODEL_TYPE=codet5 TOKENIZER=roberta-base - MODEL_NAME=${MODEL_PATH}/codet5_small + MODEL_PATH=${WORKDIR}/pretrained_models/codet5_small elif [[ $MODEL_TAG == codet5_base ]]; then MODEL_TYPE=codet5 TOKENIZER=roberta-base - MODEL_NAME=${MODEL_PATH}/codet5_base + MODEL_PATH=${WORKDIR}/pretrained_models/codet5_base fi if [[ ${TASK} == 'clone' ]]; then @@ -74,11 +65,12 @@ fi CUDA_VISIBLE_DEVICES=${GPU} \ - /export/home/miniconda3/envs/${GPU_TYPE}/bin/python ${RUN_FN} ${MULTI_TASK_AUG} \ + python ${RUN_FN} ${MULTI_TASK_AUG} \ --do_test --do_train --do_eval --do_eval_bleu --save_last_checkpoints --always_save_model \ --task ${TASK} --sub_task ${SUB_TASK} --model_type ${MODEL_TYPE} --data_num ${DATA_NUM} \ --num_train_epochs ${EPOCH} --warmup_steps ${WARMUP} --learning_rate ${LR}e-5 --patience ${PATIENCE} \ - --tokenizer_name=${TOKENIZER} --model_name_or_path=${MODEL_NAME} --output_dir ${OUTPUT_DIR} \ + --tokenizer_name=${TOKENIZER} --tokenizer_path=${WORKDIR}/tokenizer/salesforce \ + --model_name_or_path=${MODEL_PATH} --output_dir ${OUTPUT_DIR} --summary_dir ${SUMMARY_DIR} \ --data_dir ${WORKDIR}/data --cache_path ${CACHE_DIR} --res_dir ${RES_DIR} --res_fn ${RES_FN} \ --train_batch_size ${BS} --eval_batch_size ${BS} --max_source_length ${SRC_LEN} --max_target_length ${TRG_LEN} \ - 2>&1 | tee ${LOG} \ No newline at end of file + 2>&1 | tee ${LOG}