From 4200cc94b0ea51b0ea5280d0abd35c0a42608b4d Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Thu, 28 May 2020 06:03:32 +0200 Subject: [PATCH] - Added an option to run sentiment classification for CPU and selected (#4652) --- PaddleNLP/sentiment_classification/run.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PaddleNLP/sentiment_classification/run.sh b/PaddleNLP/sentiment_classification/run.sh index 63e54f22..a74d82dc 100644 --- a/PaddleNLP/sentiment_classification/run.sh +++ b/PaddleNLP/sentiment_classification/run.sh @@ -9,15 +9,19 @@ TASK_NAME='senta' DATA_PATH=./senta_data/ CKPT_PATH=./save_models MODEL_PATH=./save_models/step_1800/ +MODEL_TYPE=${MODEL_TYPE:-bilstm_net} +USE_CUDA=${USE_CUDA:-true} + # run_train on train.tsv and do_val on test.tsv train() { python -u run_classifier.py \ --task_name ${TASK_NAME} \ - --use_cuda true \ + --use_cuda $USE_CUDA \ --do_train true \ --do_val false \ --do_infer false \ + --model_type ${MODEL_TYPE} \ --batch_size 8 \ --data_dir ${DATA_PATH} \ --vocab_path ${DATA_PATH}/word_dict.txt \ @@ -33,10 +37,11 @@ train() { evaluate() { python -u run_classifier.py \ --task_name ${TASK_NAME} \ - --use_cuda true \ + --use_cuda $USE_CUDA \ --do_train false \ --do_val true \ --do_infer false \ + --model_type ${MODEL_TYPE} \ --batch_size 10 \ --data_dir ${DATA_PATH} \ --vocab_path ${DATA_PATH}/word_dict.txt \ @@ -48,10 +53,11 @@ evaluate() { infer() { python -u run_classifier.py \ --task_name ${TASK_NAME} \ - --use_cuda true \ + --use_cuda $USE_CUDA \ --do_train false \ --do_val false \ --do_infer true \ + --model_type ${MODEL_TYPE} \ --batch_size 10 \ --data_dir ${DATA_PATH} \ --vocab_path ${DATA_PATH}/word_dict.txt \ -- GitLab