-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy patht2t_trainer.py
More file actions
34 lines (26 loc) · 814 Bytes
/
Copy patht2t_trainer.py
File metadata and controls
34 lines (26 loc) · 814 Bytes
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
"""Train and evaluate."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensor2tensor.bin import t2t_trainer
from tensor2tensor.models import transformer
from tensor2tensor.utils import registry
import problems
import tensorflow as tf
@registry.register_hparams
def transformer_tall9():
hparams = transformer.transformer_big()
hparams.hidden_size = 768
hparams.filter_size = 3072
hparams.num_hidden_layers = 9
hparams.num_heads = 12
return hparams
@registry.register_hparams
def transformer_tall_18_18():
hparams = transformer_tall9()
hparams.num_encoder_layers = 18
hparams.num_decoder_layers = 18
return hparams
if __name__ == '__main__':
tf.logging.set_verbosity(tf.logging.INFO)
tf.app.run(t2t_trainer.main)