Esempio n. 1
0
def get_model_params(model: Optional[Text] = "bert2bert",
                     config_class=None) -> params_dict.ParamsDict:
  """Helper function to convert config file to ParamsDict."""
  if model == "bert2bert":
    return configs.BERT2BERTConfig()
  elif model == "nhnet":
    return configs.NHNetConfig()
  elif config_class:
    return config_class()
  else:
    raise KeyError("The model type is not defined: %s" % model)
Esempio n. 2
0
 def setUp(self):
     super(NHNetTest, self).setUp()
     self._nhnet_config = configs.NHNetConfig()
     self._nhnet_config.override(utils.get_test_params().as_dict())
     self._bert2bert_config = configs.BERT2BERTConfig()
     self._bert2bert_config.override(utils.get_test_params().as_dict())
Esempio n. 3
0
 def test_configs(self):
     cfg = configs.BERT2BERTConfig()
     cfg.validate()
     self.assertEqual(cfg.as_dict(), BERT2BERT_CONFIG)