-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (38 loc) · 1.62 KB
/
Makefile
File metadata and controls
46 lines (38 loc) · 1.62 KB
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
preprocess:
python preprocess.py \
--source-lang cs --target-lang en \
--trainpref ${RAW_DIR}/train.sp.cs-en --validpref ${RAW_DIR}/valid.sp.cs-en \
--destdir ${DATA_DIR} --joined-dictionary \
--workers 4
train_adv:
CUDA_VISIBLE_DEVICES=${CUDA} python train.py \
${DATA} \
--max-update 12800 \
--ddp-backend=no_c10d \
--arch transformer \
--optimizer adam \
--share-decoder-input-output-embed \
--adam-betas '(0.9, 0.98)' \
--lr 0.0005 --lr-scheduler inverse_sqrt --min-lr '1e-09' \
--warmup-updates 4000 --warmup-init-lr '1e-07' \
--label-smoothing 0.1 --criterion label_smoothed_cross_entropy \
--dropout 0.3 --weight-decay 0.0001 \
--save-dir ${CHECK_DIR} \
--max-tokens 4096 \
--no-epoch-checkpoints \
--update-freq 8 \
--num_cands ${NUM_CANDS} \
--src_pert_prob ${SRC_PERT_PROB} \
--tgt_pert_prob ${TGT_PERT_PROB} \
--sp_model ${SPM_DIR} \
--adv_sr
inference:
python sacreBLEU/sacrebleu.py --test-set ${TEST_DATA} --language-pair ${SRC}-${TGT} --echo src \
| python scripts/spm_encode.py --model ${SPM_DIR} \
> test.${SRC}-${TGT}.${SRC}.sp \
cat test.${SRC}-${TGT}.${SRC}.sp | CUDA_VISIBLE_DEVICES=${CUDA} python interactive.py ${DATA} \
--source-lang ${SRC} --target-lang ${TGT} --path ${CHECK_DIR} --buffer-size 2000 --batch-size 128 \
--beam 4 --remove-bpe sentencepiece \
> test.${SRC}-${TGT}.${TGT}.sys
grep ^H test.${SRC}-${TGT}.${TGT}.sys | cut -f3 \
| python sacreBLEU/sacrebleu.py --test-set ${TEST_DATA} --language-pair ${SRC}-${TGT} --smooth exp --tokenize 13a --num-refs 1 -lc