allenai / deep_qa

A deep NLP library, based on Keras / tf, focused on question answering (but useful for other NLP too)
Apache License 2.0
404 stars 133 forks source link

InputShape as a list is broken in latest keras (2.0.4) #330

Closed avr248 closed 7 years ago

avr248 commented 7 years ago

AttributeError: 'list' object has no attribute 'shape' Exception ignored in: <bound method BaseSession.del of <tensorflow.python.client.session.Session object at 0x1211e8c18>> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 582, in del AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus'

nelson-liu commented 7 years ago

Can you give some more details about where you are seeing this and how to reproduce?

avr248 commented 7 years ago

python3 scripts/run_model.py params/sentence_selection/siamese_sentence_selector_squad.json

2017-05-01 15:16:37,981 - PARAM - deep_qa.common.params - seq2seq_encoder.default.encoder_params.type = bi_gru 2017-05-01 15:16:37,982 - PARAM - deep_qa.common.params - seq2seq_encoder.default.encoder_params.l2_regularization = None 2017-05-01 15:16:37,982 - PARAM - deep_qa.common.params - seq2seq_encoder.default.encoder_params.l1_regularization = None Traceback (most recent call last): File "scripts/run_model.py", line 66, in main() File "scripts/run_model.py", line 54, in main model.train() File "scripts/../deep_qa/training/trainer.py", line 283, in train self.model = self._build_model() File "scripts/../deep_qa/models/sentence_selection/siamese_sentence_selector.py", line 83, in _build_model modeled_question = hidden_layer(modeled_question) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 585, in call output = self.call(inputs, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/layers/wrappers.py", line 263, in call y = self.forward_layer.call(inputs, kwargs) File "scripts/../deep_qa/layers/encoders/shareable_gru.py", line 12, in call self.input_spec = InputSpec(shape=(self.input_spec.shape[0], AttributeError: 'list' object has no attribute 'shape' Exception ignored in: <bound method BaseSession.del of <tensorflow.python.client.session.Session object at 0x1211e8c18>> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 582, in del AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus'

nelson-liu commented 7 years ago

Thanks. looks like this is broken on the current master too, and i think the culprit is the recent release of Keras 2.0.4.

Can you try downgrading to Keras 2.0.3 (pip uninstall keras && pip install keras==2.0.3)? That should work while we push a fix in the meantime / update the requirements to pin to keras 2.0.3

avr248 commented 7 years ago

Thank you very much. Great.

Another question: How do I handle a babi task dataset?

nelson-liu commented 7 years ago

So, right now certain models support certain datasets. For example, you can use the SoftMaxMemoryNetwork model to do a babi-style task (see https://github.com/allenai/deep_qa/blob/master/example_experiments/memory_networks/babi_experiment.json, this experiment config might be out of date).

@matt-gardner or @DeNeutoy are probably more familiar with the memory network code and might be able to comment more about this, but can you be a bit more specific with your question? Are you looking to simply solve tasks from bAbI?

avr248 commented 7 years ago

in need py script for preprocessed data

matt-gardner commented 7 years ago

Thanks, @nelson-liu, for helping with this. This issue makes me wonder if we should have some kind of checklist for issues, like keras and many other repos do... We really don't have the bandwidth to respond to issues that aren't stated clearly, now that it's just me and Mark.

@avr248, see here for info on processing the data.

nelson-liu commented 7 years ago

Yes, an issue template sounds like a good idea