Open d5d opened 7 years ago
需要安装TensorFlow,char-rnn-tf不需要安装直接运行里面的python文件即可(运行train.py文件训练模型,得到训练好的模型后可运行generate.py进行文本生成)。
求指教 :-0
ubuntu
已经安装tf.
train有如下错误提示:
root@27:~/char-rnn-tf# python train.py test.txt
data has 9437 characters, 702 unique.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "train.py", line 211, in
这个错误是TensorFlow不同版本间API不一样导致的。我的这个代码是TensorFlow 0.12,你用的应该是1.0吧。你需要把tf.nn.rnn_cell都改成tf.contrib.rnn,还有101行tf.concat(1, outputs)改成tf.concat(outputs, 1)。也不明白为何TensorFlow要改API,导致旧版的程序需要修改才能运行。汗...
已经成功运行。谢谢!
@hit-computer 不好意思,请问 Python 版本没有要求吗? Tks:)
我用的是python2,如果你使用的是python3,则按照python2和python3的不同之处修改即可,TensorFlow部分的代码应该不需要修改
需要安装tensorflow?再运行这个程序?还是安装char-rnn?