Decomposable-Attention icon indicating copy to clipboard operation
Decomposable-Attention copied to clipboard

error

Open nnn1988 opened this issue 6 years ago • 4 comments

Hi Thank you for sharing this code when I run the code I got this error

While running python3 Train.py, I am getting the following error:

Start training and evaluating ... Epoch : 1 Traceback (most recent call last): File "Train.py", line 164, in train() File "Train.py", line 93, in train _, batch_loss, batch_acc = sess.run([model.train, model.loss, model.acc], feed_dict=feed_dict)

Traceback (most recent call last): File "/home/nujud/Desktop/code/Decomposable-Attention-master/Train.py", line 166, in train() File "/home/nujud/Desktop/code/Decomposable-Attention-master/Train.py", line 95, in train _, batch_loss, batch_acc = sess.run([model.train, model.loss, model.acc], feed_dict=feed_dict) File "/home/nujud/anaconda2/envs/tensorflow-cpu/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run run_metadata_ptr) File "/home/nujud/anaconda2/envs/tensorflow-cpu/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1111, in _run str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (128,) for Tensor 'premise_mask:0', which has shape '(?, 100)'

please help Thank you in advance

Looking forward for your reply. Thanks,

nnn1988 avatar Feb 06 '19 11:02 nnn1988

There seems to be an error in either how the masking array is being built (the shape yielded by the sentences2Index() method in Utils.py is not congruent with the shape initialized in the Decomposable model in Model.py) or how the masking array is being initialized in the first place. I've tried reshaping to get (,100) instead but there are some mask arrays that have less than 100 elements, therefore I just used a try except block to check how many erroneous ones were being produced, and another try except block on the evaluate method() in Train.py to skip the arrays that did not fit.

if you have managed to solve the problem and run the full code please let me know

thefirebanks avatar Jun 18 '19 18:06 thefirebanks

Couldn't solve this problem, but found the original code that this repo may have been based from and this one works perfectly: https://github.com/cxncu001/NLI

thefirebanks avatar Jun 20 '19 15:06 thefirebanks

Returning s1MaskList and s2MaskList instead of s1Mask and s2Mask, respectively, in the sentence2Index function seems to work.

voidcentury avatar Jun 21 '19 11:06 voidcentury

thanks @voidcentury and @thefirebanks for great supports

duongkstn avatar Nov 08 '19 08:11 duongkstn