You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 7, 2023. It is now read-only.
Updated instructions & bugfix in new Problem docs (#490)
* Add helpful (I think) instructions & bugfix
* Added some instructions for using pip to create editable install so you can locally test.
* Also added commands to run the local test.
* Fixed bug with accidental `self` argument in hparams definition.
* code review comment fixes
* tweak language
* typos and more tweaks
Copy file name to clipboardExpand all lines: docs/new_problem.md
+26-3
Original file line number
Diff line number
Diff line change
@@ -240,16 +240,40 @@ All hyperparamters inherit from `_default_hparams()` in `problem.py.` If you wou
240
240
from tensor2tensor.models import transformer
241
241
242
242
@registry.register_hparams
243
-
defword2def_hparams(self):
243
+
defword2def_hparams():
244
244
hparams = transformer.transformer_base_single_gpu() # Or whatever you'd like to build off.
245
245
hparams.batch_size =1024
246
246
return hparams
247
247
```
248
248
249
+
# Test the data generation
250
+
251
+
You can test data generation of your a problem in your own project with:
252
+
253
+
```bash
254
+
PROBLEM=word2def
255
+
DATA_DIR=$HOME/t2t_data
256
+
TMP_DIR=/tmp/t2t_datagen
257
+
mkdir -p $DATA_DIR$TMP_DIR
258
+
259
+
t2t-datagen \
260
+
--t2t_usr_dir=$PATH_TO_YOUR_PROBLEM_DIR \
261
+
--data_dir=$DATA_DIR \
262
+
--tmp_dir=$TMP_DIR \
263
+
--problem=$PROBLEM
264
+
```
265
+
266
+
Where:
267
+
*`PROBLEM` is the name of the class that was registered with `@registry.register_problem()`, but converted from `CamelCase` to `snake_case`.
268
+
*`PATH_TO_YOUR_PROBLEM_DIR` is a path to the directory of your python problem file.
269
+
270
+
If you plan to contribute to the tensor2tensor repository, you can install the local cloned version in developer mode with `pip install -e .` from the tensor2tensor directory. You can also add your new problem file to [`all_problems.py`](https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/data_generators/all_problems.py).
271
+
249
272
# Run the problem
250
273
Now that we've gotten our problem set up, let's train a model and generate definitions.
251
274
252
-
We specify our problem name, the model, and hparams.
275
+
To train, specify the problem name, the model, and hparams:
276
+
253
277
```bash
254
278
PROBLEM=word2def
255
279
MODEL=transformer
@@ -258,7 +282,6 @@ HPARAMS=word2def_hparams
258
282
259
283
The rest of the steps are as given in the [walkthrough](walkthrough.md).
260
284
261
-
262
285
What if we wanted to train a model to generate words given definitions? In T2T, we can change the problem name to be `PROBLEM=word2def_rev`.
263
286
264
287
All done. Let us know what definitions your model generated.
0 commit comments