简体   繁体   中英

tflearn throws error when using gpu

When I try to use with tf.device('/gpu:0'): in my project it throws the error shown down below. I ve installed tensorflow-gpu.

Code:

def main():
    with tf.device('/gpu:0'):
        model = cnn_model.googlenet(WIDTH, HEIGHT, 3, LR, output=8,model_name=MODEL_NAME)
        model.fit({'input': batch_x}, {'targets': batch_y}, n_epoch=1,snapshot_step=2500, show_metric=True, run_id=MODEL_NAME)

cnn_model can be found here: https://github.com/MrGrimod/gta_self_driving/blob/master/model/cnn_model.py

Error:

WARNING:tensorflow:From 
C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-        
packages\tensorflow\python\util\tf_should_use.py:175:         
initialize_all_variables (from tensorflow.python.ops.variables) is 
deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.
hdf5 is not supported on this machine (please install/reinstall h5py for 
optimal experience)
curses is not supported on this machine (please install/reinstall curses for 
an optimal experience)
Traceback (most recent call last):
File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
packages\tensorflow\python\client\session.py", line 1327, in _do_call
return fn(*args)
File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
packages\tensorflow\python\client\session.py", line 1297, in _run_fn
self._extend_graph()
File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
packages\tensorflow\python\client\session.py", line 1358, in _extend_graph
self._session, graph_def.SerializeToString(), status)

File
"C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\contextlib.py"
, line 88, in __exit__
next(self.gen)
 File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
packages\tensorflow\python\framework\errors_impl.py", line 466, in 
raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Node 
'init_3/NoOp': Unknown input node '^is_training/Assign'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 57, in <module>
    main()
  File "train.py", line 26, in main
    model = cnn_model.googlenet(WIDTH, HEIGHT, 3, LR, output=8, 
model_name=MODEL_NAME)
  File "C:\Users\MrGrimod\Desktop\gta_self_driving\model\cnn_model.py", line 
147, in googlenet
    max_checkpoints=0, tensorboard_verbose=0,tensorboard_dir='log')
  File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
 packages\tflearn\models\dnn.py", line 65, in __init__
    best_val_accuracy=best_val_accuracy)
  File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
 packages\tflearn\helpers\trainer.py", line 170, in __init__
    self.session.run(init)
  File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
 packages\tensorflow\python\client\session.py", line 895, in run
     run_metadata_ptr)
   File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
 packages\tensorflow\python\client\session.py", line 1124, in _run
     feed_dict_tensor, options, run_metadata)
  File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
  packages\tensorflow\python\client\session.py", line 1321, in _do_run
     options, run_metadata)
   File "C:\Users\MrGrimod\AppData\Local\Programs\Python\Python36\lib\site-
packages\tensorflow\python\client\session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Node 
 'init_3/NoOp': Unknown input node '^is_training/Assign'
2017-09-22 09:59:42.453552: W C:\tf_jenkins\home\workspace\rel-
win\M\windows\PY\36\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.
2017-09-22 09:59:42.453565: W C:\tf_jenkins\home\workspace\rel-
win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The 
TensorFlow library wasn't compiled to use AVX2 instructions, but these are 
 available on your machine and could speed up CPU computations.

Fixed issue by uninstalling everything and then installing everything by using this manual from TensorFlow.

And by adding this line of code: tflearn.init_graph()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM