-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtraining.sh
executable file
·70 lines (54 loc) · 1.28 KB
/
training.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
#!/bin/bash
if [ -z "$1" ]
then
echo "$1 is empty"
exit 1
else
echo "running training.sh script with parameter $1"
echo "expects to find data files in $1/data"
fi
if [ -z nmt ]
then
echo "current directory does not contain required nmt dir"
exit 1
fi
REPO=$1
DATA=$REPO/data
echo "training on data in $DATA"
LOGS=$REPO/logs
MODELS=$REPO/models
rm -r $MODELS/model/hparam*
mkdir -p $LOGS
if [ -d "$MODELS/model" ]
then
mkdir -p $MODELS/model
fi
echo "output model in $MODELS/model"
echo "starting at date/time"
date
DATE=`date +"%y-%m-%d-%H-%M-%S"`
export CUDA_VISIBLE_DEVICES=2
python -m nmt.nmt \
--encoder_type=bi \
--attention=scaled_luong \
--num_units=512 \
--num_gpus=1 \
--batch_size=32 \
--src=nat --tgt=sum1 \
--vocab_prefix=$DATA/vocab \
--train_prefix=$DATA/train \
--dev_prefix=$DATA/dev \
--test_prefix=$DATA/test \
--out_dir=$MODELS/model \
--num_train_steps=4000 \
--steps_per_stats=100 \
--steps_per_external_eval=100 \
--tgt_max_len=400 \
--tgt_max_len_infer=400 \
--num_layers=2 \
--dropout=0.2 \
--metrics=bleu > $LOGS/sumonlp-$DATE
# --beam_width=10 \
# --num_translations_per_input=10 > /home/mptp/nmt1/tg1/train.log
echo "metrics found in $LOGS/sumonlp-$DATE"
echo "model is in $MODELS/model"