nmt_keras icon indicating copy to clipboard operation
nmt_keras copied to clipboard

Error in decoding

Open husky-parul opened this issue 7 years ago • 3 comments

Hi I was trying to implement your code. However I am getting the following error while decoding sequence.

decoded_sentence = decode_sequence(input_seq)
 File "nntrainmodel.py", line 173, in decode_sequence
   [target_seq] + states_value)
 File "/home/fedora/nlp/keras/examples/env/lib/python3.6/site-packages/keras/engine/training.py", line 1817, in predict
   check_batch_axis=False)
 File "/home/fedora/nlp/keras/examples/env/lib/python3.6/site-packages/keras/engine/training.py", line 86, in _standardize_input_data
   str(len(data)) + ' arrays: ' + str(data)[:200] + '...')
ValueError: Error when checking model : the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 3 array(s), but instead got the following list of 1 arrays: [array([[1.]])]...

Can you please help me with it.

husky-parul avatar Apr 04 '18 23:04 husky-parul

Seems like you are passing input to decode_model single array but it expects 3 arrays. Can you tell me any modification you have made in the code?

devm2024 avatar Apr 05 '18 18:04 devm2024

@devm2024 @husky-parul The error is in line for seq_index in [14077,20122,40035,40064, 40056, 40068, 40090, 40095, 40100, 40119, 40131, 40136, 40150, 40153]:

The indices are out of range, try with indices < 50000 such as 10, 12, ... etc. This solved the problem for me

basma-b avatar Feb 13 '19 17:02 basma-b

@basma-b all these indices are less than < 50000

[14077,20122,40035,40064, 40056, 40068, 40090, 40095, 40100, 40119, 40131, 40136, 40150, 40153]

I faced the same problem and tried with smaller indices.

Any ideas what went wrong?

nashid avatar Mar 06 '20 22:03 nashid