我已将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