tf.contrib.training.HParams error in tensorflow 2

Viewed 1298

I am trying to use nmt-chatbot from https://github.com/daniel-kukiela/nmt-chatbot but while training the model with custom data I am getting the error, as I searched on google it is because in Tensorflow v2 the "contrib" module is been removed, can anyone suggest me a replacement for that part of code,

 return tf.contrib.training.HParams(
AttributeError: module 'tensorflow' has no attribute 'contrib'
def create_hparams(flags):
 """Create training hparams."""
 return tf.contrib.training.HParams(
     # Data
     src=flags.src,
     tgt=flags.tgt,
     train_prefix=flags.train_prefix,
     dev_prefix=flags.dev_prefix,
     test_prefix=flags.test_prefix,
     vocab_prefix=flags.vocab_prefix,
     embed_prefix=flags.embed_prefix,
     out_dir=flags.out_dir,


1 Answers

You can see the fate of all the contrib API here,also here. I don't see any direct API update in the document. However, you can still use from tensorflow plugins by

from tensorboard.plugins.hparams import api as hp

For more details you can check here.

Related