thunlp / OpenNRE

An Open-Source Package for Neural Relation Extraction (NRE)
MIT License
4.36k stars 1.05k forks source link

Question #24

Closed ChenyangBLCU closed 6 years ago

ChenyangBLCU commented 7 years ago

[Excuse me,my python version is 3.5 and tensorflow version is 1.2.1,But I had some trouble when debug it.Here is the error I encountered:

C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe D:/PerfectProject/NRE/train_GRU.py reading wordembedding reading training data 2017-07-26 19:16:09.465988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2017-07-26 19:16:09.465988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2017-07-26 19:16:09.466988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\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. 2017-07-26 19:16:09.466988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\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. 2017-07-26 19:16:09.466988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\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. 2017-07-26 19:16:09.466988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\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-07-26 19:16:09.466988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\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. 2017-07-26 19:16:09.466988: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.


Tensor("model/Reshape_1:0", shape=(?, 70, 230), dtype=float32)


WARNING:tensorflow:From C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\tf_should_use.py:170: 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. Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1139, in _do_call return fn(*args) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1121, in _run_fn status, run_metadata) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\contextlib.py", line 66, in exit next(self.gen) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\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: axis 0 specified more than once. [[Node: model/ReverseV2_3 = ReverseV2[T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](model/Reshape_2, model/ReverseV2_3/axis)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:/PerfectProject/NRE/train_GRU.py", line 164, in tf.app.run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "D:/PerfectProject/NRE/train_GRU.py", line 148, in main train_step(temp_word,temp_pos1,temp_pos2,temp_y,settings.big_num) File "D:/PerfectProject/NRE/train_GRU.py", line 103, in train_step temp, step, loss, accuracy,summary,l2_loss,final_loss= sess.run([train_op, global_step, m.total_loss, m.accuracy,merged_summary,m.l2_loss,m.final_loss], feed_dict) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 789, in run run_metadata_ptr) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 997, in _run feed_dict_string, options, run_metadata) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1132, in _do_run target_list, options, run_metadata) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1152, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: axis 0 specified more than once. [[Node: model/ReverseV2_3 = ReverseV2[T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](model/Reshape_2, model/ReverseV2_3/axis)]]

Caused by op 'model/ReverseV2_3', defined at: File "D:/PerfectProject/NRE/train_GRU.py", line 164, in tf.app.run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "D:/PerfectProject/NRE/train_GRU.py", line 49, in main m = network.GRU(is_training=True, word_embeddings = wordembedding, settings = settings) File "D:\PerfectProject\NRE\network.py", line 111, in init [False, True, False]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\array_ops.py", line 2334, in reverse return gen_array_ops.reverse_v2(tensor, axis, name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 2699, in reverse_v2 name=name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op op_def=op_def) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2506, in create_op original_op=self._default_original_op, op_def=op_def) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1269, in init self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): axis 0 specified more than once. [[Node: model/ReverseV2_3 = ReverseV2[T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](model/Reshape_2, model/ReverseV2_3/axis)]]

Process finished with exit code 1

image

I'm looking forward your reply.Thank you.

samithaj commented 7 years ago

read the Requirements: Python (>=2.7) TensorFlow (=r0.11) scikit-learn (>=0.18) Matplotlib (>=2.0.0) itchat (optional)

you can use below foked repo that updates the code to Python 3 and Tensorflow 1.x https://github.com/frankxu2004/TensorFlow-NRE

ChenyangBLCU commented 7 years ago

Thank for your timely assistance,I'll try it.

QuickyFinger commented 6 years ago

Have you solve this problem ? I'm encountered with similar problem as well. How to solve it?

ChenyangBLCU commented 6 years ago

The author released a new version of this project , have you try it again?

https://github.com/frankxu2004/TensorFlow-NRE

read the Requirements: Python (>=2.7) TensorFlow (=r0.11) scikit-learn (>=0.18) Matplotlib (>=2.0.0) itchat (optional)

you can use below foked repo that updates the code to Python 3 and Tensorflow 1.x

knightmarehs commented 6 years ago

I tried https://github.com/frankxu2004/TensorFlow-NRE and get the following errors:

File "initial.py", line 31, in init f = open('./origin_data/KBP/wiki_100d.txt', encoding='utf-8') ...

As this project does not contain the directory "KBP" in "origin_data", could you tell me where can I find or how can I generate the KBP data? Thanks.

mbxmxm commented 6 years ago

I have got the errors: File "initial.py", line 31, in init f = open('./origin_data/KBP/wiki_100d.txt', encoding='utf-8') too I removed the'/KBP', and changed the data but still had errors: File "initial.py", line 624, in init() File "initial.py", line 141, in init avg_vec += vec[word2id[p]] ValueError: operands could not be broadcast together with shapes (100,) (50,) (100,) I want to know what do I need to run this program. Thanks