codekansas / keras-language-modeling

:book: Some language modeling tools for Keras
https://codekansas.github.io/language
MIT License
658 stars 170 forks source link

Output shape of the similarity merge layer is still incorrect #16

Open guxd opened 8 years ago

guxd commented 8 years ago

I use the latest version and check the similarity part of the model, i.e., qa_model = merge([question_output, answer_output], mode=similarity, output_shape=lambda x: x[:-1],name='similarity') When I invoke qa_model.summary(), here is the screen output: insuranceqa similarity

capture

The last layer (similarity) should have an output shape of (None, 1) but is (None, 200). I use the default 'cos' mode of Keras, it is (None,1). Also, the program doesn't work. It has nan loss.

codekansas commented 8 years ago

I fixed this just now. I think the output shape should just always be (None, 1). The thing is, I don't think it made a difference. I think the nan loss could be coming from somewhere else? Not sure. Let me know if this fixed it.