在nmt模型推断期间,模型正在重新训练自己

时间:2018-09-18 02:59:53

标签: python tensorflow model predict

我已将Google's official nmt notebook修改为3个文件,分别为data_prep.py,train_model.py和Inference.py。当我运行inference.py脚本时,该模型是从头开始重新训练自己,而不是使用保存的模型。代码中可能有什么错误,我该如何解决?

下面是inference.py代码

import tensorflow as tf
from train_model import inference, optimizer, encoder, decoder, inp_que, targ_ans, max_length_inp, max_length_targ, checkpoint

checkpoint_dir = './training_checkpoints'
# restoring the latest checkpoint in checkpoint_dir
checkpoint.restore(tf.train.latest_checkpoint(checkpoint_dir))

print(inference('hello', encoder, decoder, inp_que, targ_ans, max_length_inp, max_length_targ))

如果有人想看看存储库,他们可以访问它here

0 个答案:

没有答案
相关问题