-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_pipeline.sh
executable file
·61 lines (54 loc) · 1.91 KB
/
run_pipeline.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TASK="$1"
if [ "$TASK" = "insurance" ]
then
MODEL_TYPE="bert"
USE_CRF=true
MODEL_DIR="results/${TASK}-${MODEL_TYPE}-CRF${USE_CRF}"
IS_BIO=false
elif [ "$TASK" = "fastfood" ]
then
MODEL_TYPE="bert"
USE_CRF=true
MODEL_DIR="results/${TASK}-${MODEL_TYPE}-CRF${USE_CRF}"
IS_BIO=true
else
exit 1
fi
echo "Model path = ${MODEL_DIR}"
# ----------------
# Step 1: IC/SL
# 1.1 Train the JointBERT model
cd JointBERT
if [ "$USE_CRF" = true ]
then
python3 main.py --task $TASK --model_type $MODEL_TYPE --model_dir "../${MODEL_DIR}" --do_train --do_eval --use_crf
else
python3 main.py --task $TASK --model_type $MODEL_TYPE --model_dir "../${MODEL_DIR}" --do_train --do_eval
fi
# 1.2 Use the trained model to do IC/SL on the test data
python3 predict.py --input_file "../data/${TASK}/test/seq.in" --output_file "../${MODEL_DIR}/test_seq_out.txt" --model_dir "../${MODEL_DIR}"
cd ..
# ----------------
# Step 2: Run the rest of the pipeline
for PIPELINE in 'deterministic' 'probabilistic'
do
if [ "$IS_BIO" = true ]
then
python3 main.py --task $TASK --nlu_result_path "${MODEL_DIR}/test_seq_out.txt" --pipeline $PIPELINE --result_folder $MODEL_DIR --is_bio
else
python3 main.py --task $TASK --nlu_result_path "${MODEL_DIR}/test_seq_out.txt" --pipeline $PIPELINE --result_folder $MODEL_DIR
fi
done