GeezerVison is showing github.com — Add speed test for rnnslu. · zencoding/DeepLearningTutorials@f2d8320
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: code/test.py +22-5Lines changed: 22 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -86,7 +86,7 @@ def speed(): | 86 | 86 | """ | 87 | 87 |
| 88 | 88 | algo = ['logistic_sgd', 'logistic_cg', 'mlp', 'convolutional_mlp', | 89 | | - 'dA', 'SdA', 'DBN', 'rbm', 'rnnrbm'] | | 89 | + 'dA', 'SdA', 'DBN', 'rbm', 'rnnrbm', 'rnnslu'] | 90 | 90 | to_exec = [True] * len(algo) | 91 | 91 | # to_exec = [False] * len(algo) | 92 | 92 | # to_exec[-1] = True | @@ -101,9 +101,9 @@ def speed(): | 101 | 101 | # 7.1-2 (python 2.7.2, mkl unknow). BLAS with only 1 thread. | 102 | 102 |
| 103 | 103 | expected_times_64 = numpy.asarray([9.8, 22.5, 76.1, 73.7, 116.4, | 104 | | - 346.9, 381.9, 558.1, 186.3]) | | 104 | + 346.9, 381.9, 558.1, 186.3, 50.8]) | 105 | 105 | expected_times_32 = numpy.asarray([8.1, 17.9, 42.5, 66.5, 71, | 106 | | - 191.2, 226.8, 432.8, 176.2]) | | 106 | + 191.2, 226.8, 432.8, 176.2, 36.9]) | 107 | 107 |
| 108 | 108 | # Number with just 1 decimal are new value that are faster with | 109 | 109 | # the Theano version 0.5rc2 Other number are older. They are not | @@ -124,8 +124,7 @@ def speed(): | 124 | 124 |
| 125 | 125 | expected_times_gpu = numpy.asarray([3.0, 7.55523491, 18.99226785, | 126 | 126 | 5.8, 21.5, | 127 | | - 11.8, 47.9, 290.1, 315.4]) | 128 | | - | | 127 | + 11.8, 47.9, 290.1, 315.4, 72.4]) | 129 | 128 | expected_times_64 = [s for idx, s in enumerate(expected_times_64) | 130 | 129 | if to_exec[idx]] | 131 | 130 | expected_times_32 = [s for idx, s in enumerate(expected_times_32) | @@ -164,6 +163,24 @@ def do_tests(): | 164 | 163 | time_test(m, l, 7, rbm.test_rbm, training_epochs=1, batch_size=300, | 165 | 164 | n_chains=1, n_samples=1, output_folder='tmp_rbm_plots') | 166 | 165 | time_test(m, l, 8, rnnrbm.test_rnnrbm, num_epochs=1) | | 166 | + s = {'fold': 3, | | 167 | + # 5 folds 0,1,2,3,4 | | 168 | + 'data': 'atis', | | 169 | + 'lr': 0.0970806646812754, | | 170 | + 'verbose': 1, | | 171 | + 'decay': True, | | 172 | + # decay on the learning rate if improvement stops | | 173 | + 'win': 7, | | 174 | + # number of words in the context window | | 175 | + 'nhidden': 200, | | 176 | + # number of hidden units | | 177 | + 'seed': 345, | | 178 | + 'emb_dimension': 50, | | 179 | + # dimension of word embedding | | 180 | + 'nepochs': 1, | | 181 | + # 60 is recommended | | 182 | + 'savemodel': False} | | 183 | + time_test(m, l, 9, rnnslu.main, param=s) | 167 | 184 | return numpy.asarray(l) | 168 | 185 |
| 169 | 186 | #test in float64 in FAST_RUN mode on the cpu | |
|