forked from Alibaba-NLP/CLNER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infer_auto.sh
executable file
·64 lines (49 loc) · 1.81 KB
/
infer_auto.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
62
63
64
#!/bin/bash
function get_data() {
LOCAL="$1"
SENT="$2"
file="$3"
sed 's/ /\tO\n/g' <(echo -n "${LOCAL}") > $file
echo -e '<EOS> B-X' >> $file
echo "$(sed 's/ / B-X\n/g' <(echo "${SENT}"))" >> $file
cat $file
echo "The above content is outputted to $file"
}
#conda activate CLNER
#dataset_name=wnut17
#dataset_name=globalner@N-google@Q-sent@S-title_and_snippet@R-bertscore
#dataset_name=globalner@N-M-google-S-google@Q-mention_and_sent@S-title_and_snippet@R-bertscore
#dataset_name=globalner@N-M-google-S-google@Q-mention_and_sent@S-title_and_snippet@R-mentionscore+bertscore # the one mostly used in error_analysis.xlsm
dataset_name=globalner@N-M-google-S-google@Q-mention_and_sent@S-title_and_snippet@R-mentionscore_soft+bertscore
#run=4
#run=7
#run=1
#run=8
run=4
train_config_file=config/$dataset_name$run.yaml
model_path_suffix=$dataset_name$run
# model_path=/home/cwhsu/.models/xlmr-first_20epoch_2batch_2accumulate_0.000005lr_10000lrrate_eng_monolingual_crf_fast_norelearn_sentbatch_sentloss_finetune_nodev_$model_path_suffix
model_path=/home/hlv8980/recovery_on_172/resources/taggers/'A21->A22@ep-5->A23'
dataset_path=tmp_dataset
output_result_path=tmp_eval_results
config_file=$output_result_path/eval_config.yaml
get_data "$1" "$2" $dataset_path/dev.txt
mkdir -p $output_result_path
set -e
python generate_config_eval.py \
$model_path \
$dataset_path \
$train_config_file \
$output_result_path \
$config_file
set +e
echo '============'
echo local: $LOCAL >> infer.log
echo sent: $SENT >> infer.log
echo model_path: $model_path >> infer.log
comm -1 -3 --nocheck-order config/template.yaml $config_file | tee $log_file | tee -a infer.log
set -e
python train.py --config $config_file --test > $output_result_path/eval.log
cat $output_result_path/dev.tsv | tee -a infer.log
echo 'Success!' >> infer.log
set +e