NekoApocalypse / PCNN_TensorFlow

Piece-wise CNN for relation extraction.
14 stars 8 forks source link

How can i solve this error? #2

Closed ghost closed 6 years ago

ghost commented 6 years ago

File "", line 1, in runfile('D:/PythonCodes/PCNN_TensorFlow-master/train_PCNN.py', wdir='D:/PythonCodes/PCNN_TensorFlow-master')

File "d:\program files\python36\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "d:\program files\python36\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/PythonCodes/PCNN_TensorFlow-master/train_PCNN.py", line 156, in tf.app.run()

File "d:\program files\python36\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run _sys.exit(main(argv))

File "D:/PythonCodes/PCNN_TensorFlow-master/train_PCNN.py", line 139, in main settings.entity_count)

File "D:/PythonCodes/PCNN_TensorFlow-master/train_PCNN.py", line 101, in train_step feed_dict)

File "d:\program files\python36\lib\site-packages\tensorflow\python\client\session.py", line 905, in run run_metadata_ptr)

File "d:\program files\python36\lib\site-packages\tensorflow\python\client\session.py", line 1140, in _run feed_dict_tensor, options, run_metadata)

File "d:\program files\python36\lib\site-packages\tensorflow\python\client\session.py", line 1321, in _do_run run_metadata)

File "d:\program files\python36\lib\site-packages\tensorflow\python\client\session.py", line 1340, in _do_call raise type(e)(node_def, op, message)

InvalidArgumentError: indices[77,0] = 114043 is not in [0, 123) How can i solve this error?

tensorflow 1.7 python 3.6.4 作者是中国人,说汉语好了,运行train_PCNN出错的

NekoApocalypse commented 6 years ago

Have you modified the source code or training data?

It looks to me that the error is caused by the embedding_lookup operation in network.py, since 123 is supposed to be the number of position embeddings and 114043 seems to be a word token. Perhaps your code is trying to lookup a word from the position embedding matrix.

Maybe you should check if your feed_dict is correctly generated or if word embeddings are correctly loaded.

Hope that helps.

P.S. I never run this code on TensorFlow 1.7. This project was written on TensorFlow 1.4 and verified on TensorFlow 1.6. So you might have some compatibility issues.