Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 99750c4

Browse files
authored
Merge pull request #736 from rsepassi/push
v1.6.0
2 parents 5ac81b4 + 8cf5fa4 commit 99750c4

File tree

98 files changed

+1620
-1306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1620
-1306
lines changed

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Compiled python modules.
22
*.pyc
3-
*DS_Store
4-
53

64
# Byte-compiled
75
_pycache__/
@@ -18,3 +16,9 @@ dist/
1816
# Sublime project files
1917
*.sublime-project
2018
*.sublime-workspace
19+
20+
# Tests
21+
.pytest_cache/
22+
23+
# Other
24+
*.DS_Store

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ env:
88
- T2T_DATA_DIR=/tmp/t2t-data
99
- T2T_TRAIN_DIR=/tmp/t2t-train
1010
matrix:
11-
- TF_VERSION="1.4.*"
1211
- TF_VERSION="1.5.*"
1312
- TF_VERSION="1.6.*"
1413
- TF_VERSION="1.7.*"
1514
matrix:
1615
exclude:
17-
- python: "3.6"
18-
env: TF_VERSION="1.4.*"
1916
- python: "3.6"
2017
env: TF_VERSION="1.5.*"
2118
- python: "3.6"
@@ -57,13 +54,13 @@ script:
5754

5855
# Run data generation, training, and decoding on a dummy problem
5956
- t2t-datagen --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR
60-
- t2t-trainer --problems=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --train_steps=5 --eval_steps=5 --output_dir=$T2T_TRAIN_DIR
61-
- t2t-decoder --problems=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --output_dir=$T2T_TRAIN_DIR --decode_hparams='num_samples=10'
57+
- t2t-trainer --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --train_steps=5 --eval_steps=5 --output_dir=$T2T_TRAIN_DIR
58+
- t2t-decoder --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --output_dir=$T2T_TRAIN_DIR --decode_hparams='num_samples=10'
6259

6360
# Export and query (on Python 2 only)
6461
# Bug: https://github.com/tensorflow/serving/issues/819
6562
#- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]] && [[ "$TF_VERSION" == "1.6.*" ]]; then
66-
# t2t-exporter --problems=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --output_dir=$T2T_TRAIN_DIR;
63+
# t2t-exporter --problem=$T2T_PROBLEM --data_dir=$T2T_DATA_DIR --model=transformer --hparams_set=transformer_tiny --output_dir=$T2T_TRAIN_DIR;
6764
# pip install tensorflow-serving-api;
6865
# tensorflow_model_server --port=9000 --model_name=my_model --model_base_path=$T2T_TRAIN_DIR/export/Servo &
6966
# sleep 10;

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pip install tensor2tensor && t2t-trainer \
3636
--generate_data \
3737
--data_dir=~/t2t_data \
3838
--output_dir=~/t2t_train/mnist \
39-
--problems=image_mnist \
39+
--problem=image_mnist \
4040
--model=shake_shake \
4141
--hparams_set=shake_shake_quick \
4242
--train_steps=1000 \
@@ -78,13 +78,13 @@ to modify the hyperparameters if you run on a different setup.
7878
### Image Classification
7979

8080
For image classification, we have a number of standard data-sets:
81-
* ImageNet (a large data-set): `--problems=image_imagenet`, or one
81+
* ImageNet (a large data-set): `--problem=image_imagenet`, or one
8282
of the re-scaled versions (`image_imagenet224`, `image_imagenet64`,
8383
`image_imagenet32`)
84-
* CIFAR-10: `--problems=image_cifar10` (or
85-
`--problems=image_cifar10_plain` to turn off data augmentation)
86-
* CIFAR-100: `--problems=image_cifar100`
87-
* MNIST: `--problems=image_mnist`
84+
* CIFAR-10: `--problem=image_cifar10` (or
85+
`--problem=image_cifar10_plain` to turn off data augmentation)
86+
* CIFAR-100: `--problem=image_cifar100`
87+
* MNIST: `--problem=image_mnist`
8888

8989
For ImageNet, we suggest to use the ResNet or Xception, i.e.,
9090
use `--model=resnet --hparams_set=resnet_50` or
@@ -99,11 +99,11 @@ close to 97% accuracy on CIFAR-10.
9999
### Language Modeling
100100

101101
For language modeling, we have these data-sets in T2T:
102-
* PTB (a small data-set): `--problems=languagemodel_ptb10k` for
103-
word-level modeling and `--problems=languagemodel_ptb_characters`
102+
* PTB (a small data-set): `--problem=languagemodel_ptb10k` for
103+
word-level modeling and `--problem=languagemodel_ptb_characters`
104104
for character-level modeling.
105-
* LM1B (a billion-word corpus): `--problems=languagemodel_lm1b32k` for
106-
subword-level modeling and `--problems=languagemodel_lm1b_characters`
105+
* LM1B (a billion-word corpus): `--problem=languagemodel_lm1b32k` for
106+
subword-level modeling and `--problem=languagemodel_lm1b_characters`
107107
for character-level modeling.
108108

109109
We suggest to start with `--model=transformer` on this task and use
@@ -113,7 +113,7 @@ We suggest to start with `--model=transformer` on this task and use
113113
### Sentiment Analysis
114114

115115
For the task of recognizing the sentiment of a sentence, use
116-
* the IMDB data-set: `--problems=sentiment_imdb`
116+
* the IMDB data-set: `--problem=sentiment_imdb`
117117

118118
We suggest to use `--model=transformer_encoder` here and since it is
119119
a small data-set, try `--hparams_set=transformer_tiny` and train for
@@ -122,15 +122,15 @@ few steps (e.g., `--train_steps=2000`).
122122
### Speech Recognition
123123

124124
For speech-to-text, we have these data-sets in T2T:
125-
* Librispeech (English speech to text): `--problems=librispeech` for
126-
the whole set and `--problems=librispeech_clean` for a smaller
125+
* Librispeech (English speech to text): `--problem=librispeech` for
126+
the whole set and `--problem=librispeech_clean` for a smaller
127127
but nicely filtered part.
128128

129129
### Summarization
130130

131131
For summarizing longer text into shorter one we have these data-sets:
132132
* CNN/DailyMail articles summarized into a few sentences:
133-
`--problems=summarize_cnn_dailymail32k`
133+
`--problem=summarize_cnn_dailymail32k`
134134

135135
We suggest to use `--model=transformer` and
136136
`--hparams_set=transformer_prepend` for this task.
@@ -139,15 +139,15 @@ This yields good ROUGE scores.
139139
### Translation
140140

141141
There are a number of translation data-sets in T2T:
142-
* English-German: `--problems=translate_ende_wmt32k`
143-
* English-French: `--problems=translate_enfr_wmt32k`
144-
* English-Czech: `--problems=translate_encs_wmt32k`
145-
* English-Chinese: `--problems=translate_enzh_wmt32k`
146-
* English-Vietnamese: `--problems=translate_envi_iwslt32k`
142+
* English-German: `--problem=translate_ende_wmt32k`
143+
* English-French: `--problem=translate_enfr_wmt32k`
144+
* English-Czech: `--problem=translate_encs_wmt32k`
145+
* English-Chinese: `--problem=translate_enzh_wmt32k`
146+
* English-Vietnamese: `--problem=translate_envi_iwslt32k`
147147

148148
You can get translations in the other direction by appending `_rev` to
149149
the problem name, e.g., for German-English use
150-
`--problems=translate_ende_wmt32k_rev`.
150+
`--problem=translate_ende_wmt32k_rev`.
151151

152152
For all translation problems, we suggest to try the Transformer model:
153153
`--model=transformer`. At first it is best to try the base setting,
@@ -193,7 +193,7 @@ t2t-datagen \
193193
# * If you run out of memory, add --hparams='batch_size=1024'.
194194
t2t-trainer \
195195
--data_dir=$DATA_DIR \
196-
--problems=$PROBLEM \
196+
--problem=$PROBLEM \
197197
--model=$MODEL \
198198
--hparams_set=$HPARAMS \
199199
--output_dir=$TRAIN_DIR
@@ -210,7 +210,7 @@ ALPHA=0.6
210210
211211
t2t-decoder \
212212
--data_dir=$DATA_DIR \
213-
--problems=$PROBLEM \
213+
--problem=$PROBLEM \
214214
--model=$MODEL \
215215
--hparams_set=$HPARAMS \
216216
--output_dir=$TRAIN_DIR \
@@ -325,7 +325,7 @@ and hyperparameter set functions can compose other hyperparameter set functions.
325325

326326
The **trainer** binary is the main entrypoint for training, evaluation, and
327327
inference. Users can easily switch between problems, models, and hyperparameter
328-
sets by using the `--model`, `--problems`, and `--hparams_set` flags. Specific
328+
sets by using the `--model`, `--problem`, and `--hparams_set` flags. Specific
329329
hyperparameters can be overridden with the `--hparams` flag. `--schedule` and
330330
related flags control local and distributed training/evaluation
331331
([distributed training documentation](https://github.com/tensorflow/tensor2tensor/tree/master/docs/distributed_training.md)).

docs/cloud_mlengine.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ It's the same `t2t-trainer` you know and love with the addition of the
1414
DATA_DIR=gs://my-bucket/data
1515
OUTPUT_DIR=gs://my-bucket/train
1616
t2t-trainer \
17-
--problems=translate_ende_wmt32k \
17+
--problem=translate_ende_wmt32k \
1818
--model=transformer \
1919
--hparams_set=transformer_base \
2020
--data_dir=$DATA_DIR \
@@ -57,7 +57,7 @@ with `--hparams_range` and the `--autotune_*` flags:
5757

5858
```
5959
t2t-trainer \
60-
--problems=translate_ende_wmt32k \
60+
--problem=translate_ende_wmt32k \
6161
--model=transformer \
6262
--hparams_set=transformer_base \
6363
--data_dir=$DATA_DIR \

docs/cloud_tpu.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ work on any image classification data-set.
3939

4040
## Tutorial: Transformer En-De translation on TPU
4141

42-
**Note**: You'll need TensorFlow 1.5+.
43-
4442
Configure the `gcloud` CLI:
4543
```
4644
gcloud components update
@@ -71,7 +69,7 @@ Launch! It's as simple as adding the `--cloud_tpu` flag.
7169
t2t-trainer \
7270
--model=transformer \
7371
--hparams_set=transformer_tpu \
74-
--problems=translate_ende_wmt8k \
72+
--problem=translate_ende_wmt8k \
7573
--train_steps=10 \
7674
--eval_steps=10 \
7775
--local_eval_frequency=10 \
@@ -109,7 +107,7 @@ For example, to train a shake-shake model on CIFAR you can run this command.
109107
t2t-trainer \
110108
--model=shake_shake \
111109
--hparams_set=shakeshake_tpu \
112-
--problems=image_cifar10 \
110+
--problem=image_cifar10 \
113111
--train_steps=180000 \
114112
--eval_steps=9 \
115113
--local_eval_frequency=100 \

docs/index.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ to modify the hyperparameters if you run on a different setup.
4242
### Image Classification
4343

4444
For image classification, we have a number of standard data-sets:
45-
* ImageNet (a large data-set): `--problems=image_imagenet`, or one
45+
* ImageNet (a large data-set): `--problem=image_imagenet`, or one
4646
of the re-scaled versions (`image_imagenet224`, `image_imagenet64`,
4747
`image_imagenet32`)
48-
* CIFAR-10: `--problems=image_cifar10` (or
49-
`--problems=image_cifar10_plain` to turn off data augmentation)
50-
* CIFAR-100: `--problems=image_cifar100`
51-
* MNIST: `--problems=image_mnist`
48+
* CIFAR-10: `--problem=image_cifar10` (or
49+
`--problem=image_cifar10_plain` to turn off data augmentation)
50+
* CIFAR-100: `--problem=image_cifar100`
51+
* MNIST: `--problem=image_mnist`
5252

5353
For ImageNet, we suggest to use the ResNet or Xception, i.e.,
5454
use `--model=resnet --hparams_set=resnet_50` or
@@ -63,11 +63,11 @@ close to 97% accuracy on CIFAR-10.
6363
### Language Modeling
6464

6565
For language modeling, we have these data-sets in T2T:
66-
* PTB (a small data-set): `--problems=languagemodel_ptb10k` for
67-
word-level modeling and `--problems=languagemodel_ptb_characters`
66+
* PTB (a small data-set): `--problem=languagemodel_ptb10k` for
67+
word-level modeling and `--problem=languagemodel_ptb_characters`
6868
for character-level modeling.
69-
* LM1B (a billion-word corpus): `--problems=languagemodel_lm1b32k` for
70-
subword-level modeling and `--problems=languagemodel_lm1b_characters`
69+
* LM1B (a billion-word corpus): `--problem=languagemodel_lm1b32k` for
70+
subword-level modeling and `--problem=languagemodel_lm1b_characters`
7171
for character-level modeling.
7272

7373
We suggest to start with `--model=transformer` on this task and use
@@ -77,7 +77,7 @@ We suggest to start with `--model=transformer` on this task and use
7777
### Sentiment Analysis
7878

7979
For the task of recognizing the sentiment of a sentence, use
80-
* the IMDB data-set: `--problems=sentiment_imdb`
80+
* the IMDB data-set: `--problem=sentiment_imdb`
8181

8282
We suggest to use `--model=transformer_encoder` here and since it is
8383
a small data-set, try `--hparams_set=transformer_tiny` and train for
@@ -86,15 +86,15 @@ few steps (e.g., `--train_steps=2000`).
8686
### Speech Recognition
8787

8888
For speech-to-text, we have these data-sets in T2T:
89-
* Librispeech (English speech to text): `--problems=librispeech` for
90-
the whole set and `--problems=librispeech_clean` for a smaller
89+
* Librispeech (English speech to text): `--problem=librispeech` for
90+
the whole set and `--problem=librispeech_clean` for a smaller
9191
but nicely filtered part.
9292

9393
### Summarization
9494

9595
For summarizing longer text into shorter one we have these data-sets:
9696
* CNN/DailyMail articles summarized into a few sentences:
97-
`--problems=summarize_cnn_dailymail32k`
97+
`--problem=summarize_cnn_dailymail32k`
9898

9999
We suggest to use `--model=transformer` and
100100
`--hparams_set=transformer_prepend` for this task.
@@ -103,15 +103,15 @@ This yields good ROUGE scores.
103103
### Translation
104104

105105
There are a number of translation data-sets in T2T:
106-
* English-German: `--problems=translate_ende_wmt32k`
107-
* English-French: `--problems=translate_enfr_wmt32k`
108-
* English-Czech: `--problems=translate_encs_wmt32k`
109-
* English-Chinese: `--problems=translate_enzh_wmt32k`
110-
* English-Vietnamese: `--problems=translate_envi_iwslt32k`
106+
* English-German: `--problem=translate_ende_wmt32k`
107+
* English-French: `--problem=translate_enfr_wmt32k`
108+
* English-Czech: `--problem=translate_encs_wmt32k`
109+
* English-Chinese: `--problem=translate_enzh_wmt32k`
110+
* English-Vietnamese: `--problem=translate_envi_iwslt32k`
111111

112112
You can get translations in the other direction by appending `_rev` to
113113
the problem name, e.g., for German-English use
114-
`--problems=translate_ende_wmt32k_rev`.
114+
`--problem=translate_ende_wmt32k_rev`.
115115

116116
For all translation problems, we suggest to try the Transformer model:
117117
`--model=transformer`. At first it is best to try the base setting,

docs/new_problem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,6 @@ clone the repository and install it in developer mode with `pip install -e .`.
239239
# Train!
240240

241241
You can train exactly as you do in the [walkthrough](walkthrough.md) with flags
242-
`--problems=poetry_lines` and `--t2t_usr_dir=$USR_DIR`.
242+
`--problem=poetry_lines` and `--t2t_usr_dir=$USR_DIR`.
243243

244244
All done. Let us know what amazing poetry your model writes!

docs/tutorials/asr_with_transformer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ To train a model on GPU set up`OUT_DIR` and run the trainer:
2929
t2t-trainer \
3030
--model=transformer \
3131
--hparams_set=transformer_librispeech \
32-
--problems=librispeech \
32+
--problem=librispeech \
3333
--train_steps=120000 \
3434
--eval_steps=3 \
3535
--local_eval_frequency=100 \
@@ -48,7 +48,7 @@ To train a model on TPU set up `OUT_DIR` and run the trainer:
4848
t2t-trainer \
4949
--model=transformer \
5050
--hparams_set=transformer_librispeech_tpu \
51-
--problems=librispeech \
51+
--problem=librispeech \
5252
--train_steps=120000 \
5353
--eval_steps=3 \
5454
--local_eval_frequency=100 \

0 commit comments

Comments
 (0)