-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathcreate_linux_training_env.sh
38 lines (33 loc) · 1.21 KB
/
create_linux_training_env.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
#!/usr/bin/env bash
sudo apt-get install python3.7
sudo apt-get install python3-pip
pip3 install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
sudo apt-get install git
git clone https://github.com/pytorch/fairseq
cd fairseq
sudo pip3 install --editable ./
cd ..
git clone https://github.com/gaigutherz/Akkademia.git
cd Akkademia
# preprocess
../fairseq/fairseq_cli/preprocess.py \
--source-lang ak --target-lang en --trainpref NMT_input/tokenization/train \
--validpref NMT_input/tokenization/valid --testpref NMT_input/tokenization/test \
--destdir data-bin --thresholdtgt 0 --thresholdsrc 0 --workers 10
# train
# Trying learning rate of 0.1 instead of 0.5, trying to solve problem of gradients getting to inf/nan
mkdir -p checkpoints/fconv_ak_en
fairseq-train \
data-bin \
--arch fconv \
--dropout 0.1 \
--criterion label_smoothed_cross_entropy --label-smoothing 0.1 \
--optimizer nag --clip-norm 0.1 \
--lr 0.1 --lr-scheduler fixed --force-anneal 50 \
--max-tokens 4000 \
--save-dir checkpoints/fconv_ak_en
# translate
fairseq-generate \
data-bin \
--path checkpoints/fconv_ak_en/checkpoint_best.pt \
--beam 5 --remove bpe