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

Commit 36596aa

Browse files
gcampaxlukaszkaiser
authored andcommitted
trainer_lib: add problem hparams after parsing the overrides (#1053)
t2t-trainer passes problem_name=None to create_hparams(), and adds the problem hparams afterwards when creating the experiment. t2t-decoder instead relies fully on create_hparams() This inconsistency causes t2t-trainer and t2t-decoder to pass different sets of model_hparams to Problem.hparams() (before and after overrides respectively), which is problematic. Always letting the problem see the final version of the model hparams is more useful (in case the problem hparams depend on the model), so make sure the problem is added after the overrides.
1 parent 061488b commit 36596aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tensor2tensor/utils/trainer_lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ def create_hparams(hparams_set,
9696
hparams = _create_hparams_from_json(hparams_path, hparams)
9797
if data_dir:
9898
hparams.add_hparam("data_dir", data_dir)
99-
if problem_name:
100-
add_problem_hparams(hparams, problem_name)
10199
if hparams_overrides_str:
102100
tf.logging.info("Overriding hparams in %s with %s", hparams_set,
103101
hparams_overrides_str)
104102
hparams = hparams.parse(hparams_overrides_str)
103+
if problem_name:
104+
add_problem_hparams(hparams, problem_name)
105105
return hparams
106106

107107

0 commit comments

Comments
 (0)