-
Notifications
You must be signed in to change notification settings - Fork 6
/
fairseq.tconf
168 lines (138 loc) · 6.21 KB
/
fairseq.tconf
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
##################################################################################################
# Packages used
##################################################################################################
package sockeye :: .versioner=git .repo="https://github.com/mjpost/sockeye" .ref=HEAD { }
package sacrebleu :: .versioner=pip .package="sacrebleu" .tag="1.5.0" { }
package subword_nmt :: .versioner=pip .package="subword-nmt" .tag="0.3.5" { }
package mosesdecoder :: .versioner=git .repo="https://github.com/moses-smt/mosesdecoder" .ref=HEAD { }
package wmt16_scripts :: .versioner=git .repo="https://github.com/rsennrich/wmt16-scripts" .ref=HEAD { }
package sentencepiece :: .versioner=git .repo="https://github.com/google/sentencepiece" .ref="tags/v0.1.5" { # v0.1.6 throws segfault
mkdir build
cd build
cmake ..
make -j $(nproc)
}
package tools
:: .versioner=git .repo="https://github.com/shuoyangd/tape4nmt-tools" .ref=HEAD {
pip install -r requirements.txt
}
# using my fork for now, as fairseq evolves pretty fast
package fairseq
:: .versioner=git .repo="https://github.com/shuoyangd/fairseq" .ref=dev0101 {
python setup.py build develop
}
global {
##################################################################################################
# Data-related stuff
##################################################################################################
SRC=(TrainDataSource:
iwslt_deen_2014="de"
)
TRG=(TrainDataSource:
iwslt_deen_2014="en"
)
trg_lang=en # FIXME (only used by wrap_xml, under some rare cases)
train_data=(TrainDataSource:
iwslt_deen_2014=(side:
src="/path/to/iwslt/train.tags.nourl.de-en.de"
trg="/path/to/iwslt/train.tags.nourl.de-en.en"
)
)
dev_data=(DevDataSource:
iwslt_deen_dev2010=(side:
src="/path/to/iwslt/IWSLT14.TED.dev2010.de-en.de.xml"
trg="/path/to/iwslt/IWSLT14.TED.dev2010.de-en.en.xml"
)
iwslt_deen_dev2012=(side:
src="/path/to/iwslt/IWSLT14.TEDX.dev2012.de-en.de.xml"
trg="/path/to/iwslt/IWSLT14.TEDX.dev2012.de-en.en.xml"
)
)
test_data=(TestDataSource:
iwslt_deen_test2010=(side:
src="/path/to/iwslt/IWSLT14.TED.tst2010.de-en.de.xml"
trg="/path/to/iwslt/IWSLT14.TED.tst2010.de-en.en.xml"
)
iwslt_deen_test2011=(side:
src="/path/to/iwslt/IWSLT14.TED.tst2011.de-en.de.xml"
trg="/path/to/iwslt/IWSLT14.TED.tst2011.de-en.en.xml"
)
iwslt_deen_test2012=(side:
src="/path/to/iwslt/IWSLT14.TED.tst2012.de-en.de.xml"
trg="/path/to/iwslt/IWSLT14.TED.tst2012.de-en.en.xml"
)
)
##################################################################################################
# General options you should set for your environment
##################################################################################################
# All ducttape files will be written underneath this directory
ducttape_output="out"
# TRAINING CONFIGURATIONS
# all default is consistent with nematus
train_train_from="" # if there is a previous model to start with
train_train_from_state_dict="" # if there is a previous dict to start with
train_start_epoch="" # if trained for certain amount of epochs previously
train_batch_size="80"
train_optim="adam"
train_dropout=(Dropout: 0.1 0.3 0.5)
train_lr="5e-4"
train_lr_min="9e-8"
# train_lr_min=""
train_lr_shrink="0.5"
train_lr_scheduler=(LrScheduler: Default="" Transformer="inverse_sqrt")
train_warmup_init_lr=(WarmUpLr: Default="" Transformer="1e-07")
train_warmup_updates=(WarmUpUpdates: Default="" Transformer="4000")
train_criterion=(Criterion: CE="" Transformer="label_smoothed_cross_entropy")
train_label_smoothing=(LabelSmoothing: Default="" Transformer="0.1")
train_clip_norm=(ClipNorm: 0.0 0.1 0.5 1 5)
train_max_tokens="4000"
train_max_epochs="50"
train_keep_last_epochs="8"
train_weight_decay=(WeightDecay: Default="" Transformer="0.0001")
train_update_freq=(UpdateFreq: Default="" Transformer="16")
train_seed="2"
train_arch=(Architecture: conv="fconv" transformer="transformer" fconv_iwslt_de_en="fconv_iwslt_de_en" transformer_iwslt_de_en="transformer_iwslt_de_en" transformer_wmt_en_de="transformer_wmt_en_de" fconv_wmt_en_de="fconv_wmt_en_de" lstm_wiseman_iwslt_de_en="lstm_wiseman_iwslt_de_en")
train_share_input_output_embed=""
train_skip_invalid_size_inputs_valid_test="yes"
# TEST CONFIGURATIONS
test_model_selection_strategy="acc"
test_max_sent_length="300"
test_beam_size="12"
test_batch_size="32"
test_replace_unk="True"
test_remove_bpe=""
##################################################################################################
# Job parameters
##################################################################################################
# SGE: generic job flags
resource_flags="-l mem_free=2g"
# SGE: larger job flags
resource_flags_16g="-l mem_free=16g"
# SGE: flags for training a model
resource_flags_train="-q g.q -l gpu=1,mem_free=4g"
# SGE: flags for decoding
resource_flags_decode="-q g.q -l gpu=1,mem_free=4g"
# SGE: flags for notifying about job completion (put in your email address!)
action_flags="-m ae -M YOUR_EMAIL_HERE"
# The default submitter: shell (run locally) or sge (run on a grid)
submitter=(TestMode: no="sge" yes="shell")
# Virtual env location. This should be a file path to the virtual env you want loaded before tasks.
# This variable supports both conda and Python's virtualenv. For conda, use "conda:ENV" as the value,
# where "ENV" is the name of the conda environment that should be loaded. For virtualenv, supply
# the path to the script that should be loaded.
pyenv=(TestMode: no="conda:sockeye" yes="conda:sockeye-cpu")
##################################################################################################
# Preprocessing options
##################################################################################################
# sentencepiece options
sentencepiece_vocab_size=8000
sentencepiece_model_type="unigram"
# no of BPE operations
bpe_operations=(BpeMergeOps: 49500 9500)
# options for cleaning training data
MaxLen=80
Ratio=1
# flags for moses tokenizer
tokenizer_flags="-no-escape -a -q"
use_cpu=(TestMode: no yes)
}