|  | 
| 29 | 29 | from tensor2tensor.utils import data_reader | 
| 30 | 30 | from tensor2tensor.utils import metrics | 
| 31 | 31 | from tensor2tensor.utils import mlperf_log | 
|  | 32 | +from tensor2tensor.utils.hparam import HParams | 
| 32 | 33 | 
 | 
| 33 | 34 | import tensorflow as tf | 
| 34 | 35 | from tensorflow.contrib.tpu.python.tpu import tpu_config | 
| @@ -130,7 +131,7 @@ class TaskID(object): | 
| 130 | 131 | 
 | 
| 131 | 132 | 
 | 
| 132 | 133 | def default_model_hparams(): | 
| 133 |  | -  return tf.contrib.training.HParams( | 
|  | 134 | +  return HParams( | 
| 134 | 135 |       max_input_seq_length=0, | 
| 135 | 136 |       max_target_seq_length=0, | 
| 136 | 137 |       prepend_mode="none", | 
| @@ -596,7 +597,7 @@ def dataset(self, | 
| 596 | 597 |       output_buffer_size: int, how many elements to prefetch at end of pipeline. | 
| 597 | 598 |       shuffle_files: whether to shuffle input files. Default behavior (i.e. when | 
| 598 | 599 |         shuffle_files=None) is to shuffle if mode == TRAIN. | 
| 599 |  | -      hparams: tf.contrib.training.HParams; hparams to be passed to | 
|  | 600 | +      hparams: HParams; hparams to be passed to | 
| 600 | 601 |         Problem.preprocess_example and Problem.hparams. If None, will use a | 
| 601 | 602 |         default set that is a no-op. | 
| 602 | 603 |       preprocess: bool, whether to map the Dataset through | 
| @@ -992,9 +993,9 @@ def _create_modalities(problem_hparams, model_hparams): | 
| 992 | 993 |   """Creates modalities and overrides any according to model hparams. | 
| 993 | 994 | 
 | 
| 994 | 995 |   Args: | 
| 995 |  | -    problem_hparams: tf.contrib.training.HParams for the Problem. It must have | 
|  | 996 | +    problem_hparams: HParams for the Problem. It must have | 
| 996 | 997 |       modality which is a dict of strings to ModalityTypes or Modality classes. | 
| 997 |  | -    model_hparams: tf.contrib.training.HParams for the model. It may have | 
|  | 998 | +    model_hparams: HParams for the model. It may have | 
| 998 | 999 |       input_modalities and target_modality, which will override | 
| 999 | 1000 |       problem_hparams' modality input and target keys. | 
| 1000 | 1001 | 
 | 
| @@ -1024,7 +1025,7 @@ def _create_modalities(problem_hparams, model_hparams): | 
| 1024 | 1025 | 
 | 
| 1025 | 1026 | def _default_hparams(): | 
| 1026 | 1027 |   """A set of basic model hyperparameters.""" | 
| 1027 |  | -  return tf.contrib.training.HParams( | 
|  | 1028 | +  return HParams( | 
| 1028 | 1029 |       # Use this parameter to get comparable perplexity numbers with different | 
| 1029 | 1030 |       # tokenizations.  This value should be set to the ratio of the number of | 
| 1030 | 1031 |       # tokens in the test set according to the tokenization used to the number | 
|  | 
0 commit comments