@@ -60,6 +60,7 @@ def test_glove():
60
60
time .sleep (5 )
61
61
62
62
63
+ @pytest .mark .skip_master
63
64
@pytest .mark .serial
64
65
@pytest .mark .remote_required
65
66
@pytest .mark .gpu
@@ -102,18 +103,15 @@ def test_embedding_evaluate_from_path(evaluateanalogies, maxvocabsize):
102
103
@pytest .mark .serial
103
104
@pytest .mark .remote_required
104
105
@pytest .mark .gpu
105
- def test_sentiment_analysis_finetune ():
106
- process = subprocess .check_call (['python' , './scripts/sentiment_analysis/finetune_lm.py' ,
107
- '--gpu' , '0' , '--batch_size' , '32' , '--bucket_type' , 'fixed' ,
108
- '--epochs' , '1' , '--dropout' , '0' , '--no_pretrained' ,
109
- '--lr' , '0.005' , '--valid_ratio' , '0.1' ,
110
- '--save-prefix' , 'imdb_lstm_200' ])
111
- time .sleep (5 )
112
- process = subprocess .check_call (['python' , './scripts/sentiment_analysis/finetune_lm.py' ,
113
- '--gpu' , '0' , '--batch_size' , '32' , '--bucket_type' , 'fixed' ,
114
- '--epochs' , '1' , '--dropout' , '0' ,
115
- '--lr' , '0.005' , '--valid_ratio' , '0.1' ,
116
- '--save-prefix' , 'imdb_lstm_200' ])
106
+ @pytest .mark .parametrize ('use_pretrained' , [True , False ])
107
+ def test_sentiment_analysis_finetune (use_pretrained ):
108
+ args = ['--gpu' , '0' , '--batch_size' , '32' , '--bucket_type' , 'fixed' ,
109
+ '--epochs' , '1' , '--dropout' , '0' ,
110
+ '--lr' , '0.005' , '--valid_ratio' , '0.1' ,
111
+ '--save-prefix' , 'imdb_lstm_200' ]
112
+ if not use_pretrained :
113
+ args .append ('--no_pretrained' )
114
+ process = subprocess .check_call (['python' , './scripts/sentiment_analysis/finetune_lm.py' ]+ args )
117
115
time .sleep (5 )
118
116
119
117
@pytest .mark .serial
@@ -126,18 +124,21 @@ def test_sentiment_analysis_textcnn():
126
124
'--data_name' , 'MR' , '--save-prefix' , 'sa-model' ])
127
125
time .sleep (5 )
128
126
127
+ @pytest .mark .skip_master
129
128
@pytest .mark .remote_required
130
- def test_sampling ():
131
- process = subprocess .check_call (['python' , './scripts/text_generation/sequence_sampling.py' ,
132
- '--use-beam-search' , '--bos' , 'I love it' , '--beam_size' , '2' ,
133
- '--print_num' , '1' ])
134
- time .sleep (5 )
135
- process = subprocess .check_call (['python' , './scripts/text_generation/sequence_sampling.py' ,
136
- '--use-sampling' , '--bos' , 'I love it' , '--beam_size' , '2' ,
137
- '--print_num' , '1' , '--temperature' , '1.0' ])
129
+ @pytest .mark .parametrize ('method' , ['beam_search' , 'sampling' ])
130
+ def test_sampling (method ):
131
+ args = ['--bos' , 'I love it' , '--beam_size' , '2' , '--print_num' , '1' ]
132
+ if method == 'beam_search' :
133
+ args .append ('--use-beam-search' )
134
+ if method == 'sampling' :
135
+ args .extend (['--use-sampling' , '--temperature' , '1.0' ])
136
+ process = subprocess .check_call (['python' , './scripts/text_generation/sequence_sampling.py' ]
137
+ + args )
138
138
time .sleep (5 )
139
139
140
140
141
+ @pytest .mark .skip_master
141
142
@pytest .mark .serial
142
143
@pytest .mark .remote_required
143
144
@pytest .mark .gpu
@@ -153,23 +154,16 @@ def test_gnmt():
153
154
@pytest .mark .serial
154
155
@pytest .mark .remote_required
155
156
@pytest .mark .gpu
156
- def test_transformer ():
157
- process = subprocess .check_call (['python' , './scripts/machine_translation/train_transformer.py' ,
158
- '--dataset' , 'TOY' , '--src_lang' , 'en' , '--tgt_lang' , 'de' ,
159
- '--batch_size' , '32' , '--optimizer' , 'adam' ,
160
- '--num_accumulated' , '1' , '--lr' , '1.0' ,
161
- '--warmup_steps' , '2000' , '--save_dir' , 'test' ,
162
- '--epochs' , '1' , '--gpus' , '0' , '--scaled' , '--average_start' ,
163
- '1' , '--num_buckets' , '5' , '--bleu' , 'tweaked' , '--num_units' ,
164
- '32' , '--hidden_size' , '64' , '--num_layers' , '2' ,
165
- '--num_heads' , '4' , '--test_batch_size' , '32' ])
166
- process = subprocess .check_call (['python' , './scripts/machine_translation/train_transformer.py' ,
167
- '--dataset' , 'TOY' , '--src_lang' , 'en' , '--tgt_lang' , 'de' ,
168
- '--batch_size' , '32' , '--optimizer' , 'adam' ,
169
- '--num_accumulated' , '1' , '--lr' , '1.0' ,
170
- '--warmup_steps' , '2000' , '--save_dir' , 'test' ,
171
- '--epochs' , '1' , '--gpus' , '0' , '--scaled' , '--average_start' ,
172
- '1' , '--num_buckets' , '5' , '--bleu' , '13a' , '--num_units' ,
173
- '32' , '--hidden_size' , '64' , '--num_layers' , '2' ,
174
- '--num_heads' , '4' , '--test_batch_size' , '32' ])
157
+ @pytest .mark .parametrize ('bleu' , ['tweaked' , '13a' ])
158
+ def test_transformer (bleu ):
159
+ args = ['--dataset' , 'TOY' , '--src_lang' , 'en' , '--tgt_lang' , 'de' ,
160
+ '--batch_size' , '32' , '--optimizer' , 'adam' ,
161
+ '--num_accumulated' , '1' , '--lr' , '1.0' ,
162
+ '--warmup_steps' , '2000' , '--save_dir' , 'test' ,
163
+ '--epochs' , '1' , '--gpus' , '0' , '--scaled' , '--average_start' ,
164
+ '1' , '--num_buckets' , '5' , '--bleu' , bleu , '--num_units' ,
165
+ '32' , '--hidden_size' , '64' , '--num_layers' , '2' ,
166
+ '--num_heads' , '4' , '--test_batch_size' , '32' ]
167
+ process = subprocess .check_call (['python' , './scripts/machine_translation/train_transformer.py' ]
168
+ + args )
175
169
time .sleep (5 )
0 commit comments