Skip to content
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

your code cannot work #5

Open
LeonCgh opened this issue Apr 15, 2017 · 4 comments
Open

your code cannot work #5

LeonCgh opened this issue Apr 15, 2017 · 4 comments

Comments

@LeonCgh
Copy link

LeonCgh commented Apr 15, 2017

ValueError: Variable rnn/basic_lstm_cell/weights already exists, disallowed. Did you mean to set reuse=True in VarScope

@LouisScorpio
Copy link
Owner

@LeonCgh 可以设置reuse=True,也可以训练和预测分开进行

@LeonCgh
Copy link
Author

LeonCgh commented Apr 20, 2017

非常感谢。还有一个问题是你的test data 里的mean是测试集的mean,这样子不会引入未来函数么?

@awaibj
Copy link

awaibj commented May 17, 2017

@LouisScorpio 我在运行第一个程序stock_predict.py时遇到类似的问题,
ValueError: Variable RNN/BasicLSTMCell/Linear/Matrix already exists, disallowed. Did you mean to set reuse=True in VarScope?
我想咨询一下,如果要设置reuse=True ,应该在什么位置设置?
后来修改为先训练,训练完成后屏蔽train_lstm(),直接调用预测prediction(),出现如下错误:
TypeError: expected bytes, NoneType found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/python/myPyCharm/myTest/stock_predict/stock_predict_ansi.py", line 137, in
prediction()
File "D:/python/myPyCharm/myTest/stock_predict/stock_predict_ansi.py", line 120, in prediction
saver.restore(sess, module_file)
File "C:\Users\feng.si\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1388, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Users\feng.si\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 766, in run
run_metadata_ptr)
File "C:\Users\feng.si\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 964, in _run
feed_dict_string, options, run_metadata)
File "C:\Users\feng.si\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1014, in _do_run
target_list, options, run_metadata)
File "C:\Users\feng.si\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1021, in _do_call
return fn(*args)
File "C:\Users\feng.si\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1003, in _run_fn
status, run_metadata)
SystemError: returned a result with an error set
好像是恢复保存的模型没有成功,不知道什么原因?

@awaibj
Copy link

awaibj commented May 17, 2017

@LouisScorpio 刚才在你的博客上找到了ValueError: Variable RNN/BasicLSTMCell/Linear/Matrix already exists, disallowed. Did you mean to set reuse=True in VarScope?这个问题的解决办法,非常感谢!
还有一个关于模型保存的问题,我看代码里面是保存为'stock.model',但是在读取的时候为什么变成了'module2/',不太理解,希望得到解答,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants