zhiguowang / BiMPM

BiMPM: Bilateral Multi-Perspective Matching for Natural Language Sentences
Apache License 2.0
438 stars 150 forks source link

Can't run on GPU #36

Closed Chunlinx closed 6 years ago

Chunlinx commented 6 years ago

Hi, when i try to run your code on the GPU , I got an error as follow: 2018-05-14 20:28:33.623427: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA Traceback (most recent call last): File "SentenceMatchTrainer.py", line 263, in main(FLAGS) File "SentenceMatchTrainer.py", line 201, in main sess.run(initializer) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 895, in run run_metadata_ptr) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1128, in _run feed_dict_tensor, options, run_metadata) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1344, in _do_run options, run_metadata) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1363, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation 'Model/word_embedding': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. [[Node: Model/word_embedding = VariableV2[container="", dtype=DT_FLOAT, shape=[35611,300], shared_name="", _device="/device:GPU:0"]()]]

Caused by op u'Model/word_embedding', defined at: File "SentenceMatchTrainer.py", line 263, in main(FLAGS) File "SentenceMatchTrainer.py", line 185, in main is_training=True, options=FLAGS, global_step=global_step) File "/home/chunlin/exp/BiMPM_SNLI/src/SentenceMatchModelGraph.py", line 10, in init self.create_model_graph(num_classes, word_vocab, char_vocab, is_training, global_step=global_step) File "/home/chunlin/exp/BiMPM_SNLI/src/SentenceMatchModelGraph.py", line 57, in create_model_graph initializer=tf.constant(word_vocab.word_vecs), dtype=tf.float32) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1262, in get_variable constraint=constraint) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1097, in get_variable constraint=constraint) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 435, in get_variable constraint=constraint) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 404, in _true_getter use_resource=use_resource, constraint=constraint) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 806, in _get_single_variable constraint=constraint) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 229, in init constraint=constraint) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 351, in _init_from_args name=name) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 133, in variable_op_v2 shared_name=shared_name) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 1061, in _variable_v2 shared_name=shared_name, name=name) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op op_def=op_def) File "/home/chunlin/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1625, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'Model/word_embedding': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. [[Node: Model/word_embedding = VariableV2[container="", dtype=DT_FLOAT, shape=[35611,300], shared_name="", _device="/device:GPU:0"]()]]

could you please tell me why this happened?