Ica*_*rus 5 python artificial-intelligence chatbot tensorflow tensorflow2.0
我正在尝试使用https://github.com/daniel-kukiela/nmt-chatbot中的 nmt-chatbot但在使用自定义数据训练模型时出现错误,正如我在 google 上搜索的那样,这是因为在 Tensorflow v2 中“contrib”模块已被删除,任何人都可以建议我替换该部分代码,
return tf.contrib.training.HParams(
AttributeError: module 'tensorflow' has no attribute 'contrib'
Run Code Online (Sandbox Code Playgroud)
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,
Run Code Online (Sandbox Code Playgroud)
小智 0
您可以在这里看到所有 contrib API 的命运,也可以在这里。我在文档中没有看到任何直接的 API 更新。但是,您仍然可以通过tensorflow插件使用
from tensorboard.plugins.hparams import api as hp
Run Code Online (Sandbox Code Playgroud)
欲了解更多详情,您可以查看此处。