forked from ducthanhtran/language_model_sockeye
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain.wmt18.tren.translation.sh
executable file
·72 lines (64 loc) · 2.59 KB
/
train.wmt18.tren.translation.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
#!/bin/bash
###########################################################
# Constants
DATA_DIR="/work/smt2/tran/work/wmt18/tren/data"
TRAIN_S="${DATA_DIR}/train.en"
TRAIN_T="${DATA_DIR}/train.tr"
DEV_S="${DATA_DIR}/dev-newsdev2016.en"
DEV_T="${DATA_DIR}/dev-newsdev2016.tr"
OUTPUT="${DATA_DIR}/models/with_lm/output"
###########################################################
function file_exists {
if [ ! -f "${1}" ]; then
echo "File "${1}" not found!"
exit 1
fi
}
function create_if_directory_does_not_exists {
if [ ! -d "${1}" ]; then
mkdir -p "${1}"
fi
}
###########################################################
## Main
file_exists "${TRAIN_S}"
file_exists "${TRAIN_T}"
file_exists "${DEV_S}"
file_exists "${DEV_T}"
create_if_directory_does_not_exists "${OUTPUT}"
source /work/smt2/tran/work/virtualenvs/sockeye_latest_17th_may/bin/activate
python -m sockeye.train -s "${TRAIN_S}" \
-t "${TRAIN_T}" \
-vs "${DEV_S}" \
-vt "${DEV_T}" \
--batch-type word \
--batch-size 16384 \
--checkpoint-frequency 4000 \
--disable-device-locking \
--device-ids -1 \
--encoder transformer \
--decoder transformer \
--num-layers 6:6 \
--transformer-model-size 512 \
--transformer-attention-heads 8 \
--transformer-feed-forward-num-hidden 2048 \
--transformer-preprocess n \
--transformer-postprocess dr \
--transformer-dropout-prepost 0.3 \
--transformer-dropout-attention 0.3 \
--transformer-dropout-act 0.3 \
--embed-dropout 0.3:0.3 \
--max-seq-len 75:75 \
--label-smoothing 0.1 \
--weight-tying \
--weight-tying-type src_trg_softmax \
--num-embed 512:512 \
--initial-learning-rate 0.0001 \
--learning-rate-reduce-num-not-improved 3 \
--learning-rate-reduce-factor 0.7 \
--learning-rate-warmup 0 \
--max-num-checkpoint-not-improved 8 \
--weight-init-scale 3.0 \
--weight-init-xavier-factor-type avg \
--output "${OUTPUT}"
deactivate