wjbianjason / Dynamic-Clip-Attention

Implemention of A Compare-Aggregate Model with Dynamic-Clip Attention for Answer Selection
29 stars 10 forks source link

Merge Exception #3

Open zhanghaoie opened 6 years ago

zhanghaoie commented 6 years ago

Hi,

There is an Exception during running the model, how could you solve this problem?

Traceback (most recent call last): File "main.py", line 176, in main(args) File "main.py", line 103, in main train_model, predict_model = ModelFactory.get_model(model_param, embedding_file, vocab_all.NumIds(),model_type=args.model) File "/Users/lafel/PycharmProjects/Dynamic-Clip-Attention/qa/model_factory.py", line 635, in get_model return ModelFactory.get_listwise_model(model_param, embedding_file, vocab_size) File "/Users/lafel/PycharmProjects/Dynamic-Clip-Attention/qa/model_factory.py", line 187, in get_listwise_model basic_model = get_core_model(model_param,embedding_file,vocab_size) File "/Users/lafel/PycharmProjects/Dynamic-Clip-Attention/qa/model_factory.py", line 111, in get_core_model ques_atten_metrics = Attend(question_proj,answer_proj) File "/Users/lafel/PycharmProjects/Dynamic-Clip-Attention/qa/model_factory.py", line 34, in call output_shape=(self.ques_length, self.answer_length)) File "/Users/lafel/anaconda3/envs/clip/lib/python2.7/site-packages/keras/engine/topology.py", line 1414, in merge name=name) File "/Users/lafel/anaconda3/envs/clip/lib/python2.7/site-packages/keras/engine/topology.py", line 1114, in init self.add_inbound_node(layers, node_indices, tensor_indices) File "/Users/lafel/anaconda3/envs/clip/lib/python2.7/site-packages/keras/engine/topology.py", line 543, in add_inbound_node Node.create_node(self, inbound_layers, node_indices, tensor_indices) File "/Users/lafel/anaconda3/envs/clip/lib/python2.7/site-packages/keras/engine/topology.py", line 155, in create_node output_shapes = to_list(outbound_layer.get_output_shape_for(input_shapes)) File "/Users/lafel/anaconda3/envs/clip/lib/python2.7/site-packages/keras/engine/topology.py", line 1269, in get_output_shape_for 'output_shape to Merge.') Exception: The Merge layer merge_3 has a callable mode argument, and we cannot infer its output shape because no output_shape argument was provided.Make sure to pass a shape tuple (or a callable) output_shape to Merge.

Best, Hao

david-yoon commented 6 years ago

I've got the same error.

[environments] theano 0.8

Could you let me know how to run the code for training?

Thanks, David

nangying1112 commented 5 years ago

The Merge layer merge_3 has a callable mode argument, and we cannot infer its output shape because no output_shape argument was provided

Hello, I've got the same error. Have you solved this?