-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain.sh
executable file
·100 lines (85 loc) · 2.04 KB
/
train.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
function train_sentence_splitter {
echo
echo ========== Training RoSentenceSplitter ==========
echo
# Delete all model files for the RoSentenceSplitter model
rm -fv data/models/splitter/model.pt
rm -fv data/models/splitter_feat_len.txt
rm -fv data/models/splitter_unic_props.txt
# Retrain the sentence splitter model
python3 -m rodna.splitter
echo
echo ========== End training RoSentenceSplitter ==========
echo
}
function train_morphology {
echo
echo ========== Training RoInflect ==========
echo
# Delete all model files for the RoInflect model
rm -fv data/models/morphology/model.pt
rm -fv data/models/char_ids.txt
rm -fv data/models/unknown_aclasses.txt
# Retrain the morphology model
python3 -m rodna.morphology
echo
echo ========== End training RoInflect ==========
echo
}
function train_pos_tagger {
echo
echo ========== Training RoPOSTagger ==========
echo
# Delete all model files for the RoPOSTagger model
rm -fv data/models/tagger/cls/config.json
rm -fv data/models/tagger/cls/model.pt
rm -fv data/models/tagger/crf/config.json
rm -fv data/models/tagger/crf/model.pt
rm -fv data/models/tagger_unic_props.txt
rm -fv data/models/word_ids.txt
# Retrain the tagger model
python3 -m rodna.tagger
echo
echo ========== End training RoPOSTagger ==========
echo
}
function train_dep_parser {
echo
echo ========== Training RoDepParser ==========
echo
# Model files for the RoDepParser models 1 and 2 are automatically deleted
# and the best model is saved
# Retrain the parser model
python3 -m rodna.parser
echo
echo ========== End training RoDepParser ==========
echo
}
if [[ $# -eq 0 ]]; then
echo "Usage: train.sh [-split|-morph|-postag|-deppar|-all]"
exit 1
fi
for MODULE in "$@"
do
case $MODULE in
-split)
time train_sentence_splitter
;;
-morph)
time train_morphology
;;
-postag)
time train_pos_tagger
;;
-deppar)
time train_dep_parser
;;
-all)
time train_sentence_splitter
time train_morphology
time train_pos_tagger
time train_dep_parser
;;
esac
done