YerevaNN / R-NET-in-Keras

Open R-NET (hy` առնետ 🐁) implementation and detailed analysis: https://git.io/vd8dx
http://yerevann.github.io/2017/08/25/challenges-of-reproducing-r-net-neural-network-using-keras/
MIT License
178 stars 88 forks source link

Assertion Error problem #25

Open YvesHarrison opened 6 years ago

YvesHarrison commented 6 years ago

I used this command to predict: python predict.py --batch_size 100 --dev_data data/dev_data_str.pkl models/31-t3.05458271443-v3.27696280528.model prediction.json But I came across an assertion problem: Preparing model...Traceback (most recent call last): File "predict.py", line 33, in model = load_model(args.model, custom_objects()) File "build/bdist.linux-x86_64/egg/keras/models.py", line 233, in load_model File "build/bdist.linux-x86_64/egg/keras/models.py", line 307, in model_from_config File "build/bdist.linux-x86_64/egg/keras/layers/init.py", line 54, in deserialize File "build/bdist.linux-x86_64/egg/keras/utils/generic_utils.py", line 139, in deserialize_keras_object File "build/bdist.linux-x86_64/egg/keras/engine/topology.py", line 2450, in from_config File "build/bdist.linux-x86_64/egg/keras/engine/topology.py", line 2447, in process_layer File "build/bdist.linux-x86_64/egg/keras/engine/topology.py", line 571, in call File "/home/lxz/nlpProject/R-NET-in-Keras/layers/QuestionPooling.py", line 26, in build assert(isinstance(input_shape, list) and len(input_shape) == 5) AssertionError

What should I do to fix it?

mdhuggins commented 6 years ago

I am also having this issue. @YvesHarrison were you able to make any progress? @mahnerak @MartinXPN are you aware of a solution?

mahnerak commented 6 years ago

Are you sure the dev_data_str.pkl is result of this command from the instruction?

python preprocessing.py data/dev_parsed.json --outfile data/dev_data_str.pkl --include_str
mdhuggins commented 6 years ago

@mahnerak Yes, I just ran it again to double check. I'm running Theano==1.0.0 and Keras==2.0.6, are those appropriate versions?

I printed the input shape right before the assertion, and got this: [(None, None, 90), (90, 45), (90, 45), (45, 1)]

jeganrajrajan commented 5 years ago

i'm very new in this field. can you help me solve the Assertion Error problem. i ran the code keras = 2.0.6 , python = 2.7 version. But i got an issue:

Using TensorFlow backend. WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1192: calling reduce_sum_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1192: calling reduce_sum_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1315: calling reduce_any_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1315: calling reduce_any_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:2878: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:2878: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1210: calling reduce_prod_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1210: calling reduce_prod_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1156: calling reduce_max_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead WARNING:tensorflow:From /media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:1156: calling reduce_max_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead Preparing model...Traceback (most recent call last): File "predict.py", line 33, in model = load_model(args.model, custom_objects()) File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/models.py", line 233, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/models.py", line 307, in model_from_config return layer_module.deserialize(config, custom_objects=custom_objects) File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/layers/init.py", line 54, in deserialize printable_module_name='layer') File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/utils/generic_utils.py", line 139, in deserialize_keras_object list(custom_objects.items()))) File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/engine/topology.py", line 2450, in from_config process_layer(layer_data) File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/engine/topology.py", line 2447, in process_layer layer(input_tensors, **kwargs) File "/media/administrator/D/Rnet/rnetenv/local/lib/python2.7/site-packages/keras/engine/topology.py", line 571, in call self.build(input_shapes) File "/home/administrator/Downloads/R-NET-in-Keras-master/layers/QuestionPooling.py", line 26, in build assert(isinstance(input_shape, list) and len(input_shape) == 5) AssertionError