-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
训练+预测输入正常,单独预测输出就乱七八糟,请问这是什么原因? #9
Comments
遇到了同样的问题~ |
还再纠结这个问题么? |
@callwhl 问题解决了么? |
因为词汇表在训练的时候和预测时候使用的不是同一个,因为vocab是通过set建立的,set中的元素顺序不一样,所以在预测时候生成类似于乱码的文本。解决方法是,在训练的时候将得到的词汇表存储下来,在预测的时候使用训练时候的词汇表。 |
注意:存的时候如果直接pkl.dump那个vocab set,继续会有同样问题 |
请问怎么把训练和测试代码分开。我用的pycharm,不是ipython,. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
单独使用
checkpoint = tf.train.latest_checkpoint('checkpoints')
samp = sample(checkpoint, 2000, lstm_size, prime="The")
print(samp)
输出的就乱七八糟
The text was updated successfully, but these errors were encountered: