question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keras Entailment Example

See original GitHub issue

I had a few doubts/questions about the Keras Entailment example

  1. Why do we have to pass the model_dir? And if we don’t pass it, shouldn’t there be a default path? Also, it’s not being used in the train method at all - or is it? In the other methods it’s only loading from the directory passed, but I don’t think the train method (or any other method) is storing it anywhere - or am I missing something here?

  2. In the readme it asks for the directory for the training/evaluation, but what it needs is the path to the json file. Unless I’ve misunderstood something - it would be better to have this clarified on the readme (explicitly mentioning it needs a path to the son file).

  3. If you, for example, run either demo, or evaluate, which need less parameters, it still throws up the : error: too few arguments message.

  4. This could be because I’ve again, missed something somewhere - but when I run either evaluate or demo, I get this - NameError: global name 'SimilarityModel' is not defined from the spacy_hook file. What exactly is supposed to be happening here? The training works fine, and so does the pytest.

[btw- the pytest sometimes fails if you’re using a virtualenv, where you’d have to re-install pytest]

I wouldn’t mind opening a PR to make the documentation changes (if you think they would be helpful/necessary).

I’m in the process of making a jupyter notebook which tries to walkthrough all of this, because I think the information in the readme isn’t detailed enough about how to exactly get this to run. Also wanted demonstrate it (with some results).

Your Environment

  • Operating System: OS X El Capitan
  • Python Version Used: 2.7.12
  • spaCy Version Used: 1.6.0
  • Environment Information:

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
jfoster17commented, Feb 9, 2017

I encountered this same problem and fixed it by selectively restoring part of an older version of keras. This commit:

https://github.com/fchollet/keras/commit/6417d90d5c1f70844d8d346312f1b40f449545a5#diff-56dc3cc42e1732fdb3a3c2c3c8efa32a

and this one:

https://github.com/fchollet/keras/commit/570fdf31c5cb9a580496d1d93320bc7ab1b9ad46#diff-56dc3cc42e1732fdb3a3c2c3c8efa32a

Introduces some code into keras/utils/generic_utils.py to allow for saving and re-loading of closures, but then this one:

https://github.com/fchollet/keras/commit/edae1785327dd7a418ac06c2fe85a8c1f6ea05b7#diff-56dc3cc42e1732fdb3a3c2c3c8efa32a

Removes the function that restores the closures. The comments on this commit claim that this was “broken” code, but it worked fine for me.

I just made sure that the functions related to closures were as in https://github.com/fchollet/keras/commit/570fdf31c5cb9a580496d1d93320bc7ab1b9ad46#diff-56dc3cc42e1732fdb3a3c2c3c8efa32a and this part worked.

Since this is obviously a bit unstable in keras right now, it would be better to see if this can be redone without closures.

(Also note that by default the example trains a model with max_length = 100 but uses max_length = 10 when running demo or evaluate. You’ll have to change one of these to make it work).

1reaction
saurabhhssaurabhcommented, Sep 18, 2017

I got it working by applying this. Why this fix is not included in keras latest code ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multimodal entailment - Keras
In this example, we will build and train a model for predicting multimodal entailment. We will be using the multimodal entailment dataset ...
Read more >
Textual entailment with TensorFlow - O'Reilly
In this section, we'll walk through a few examples of textual entailment to illustrate what we mean by positive, negative, and neutral ......
Read more >
keras-io/multimodal-entailment - Hugging Face
Introduction. In this example, we will build and train a model for predicting multimodal entailment. We will be using the multimodal entailment dataset...
Read more >
Trying to run Spacy Textual entailment example and getting a ...
Trying to run Spacy Textual entailment example and getting a value error (keras) ... Hi guys I'm trying to run the spacy example...
Read more >
Recognizing Multimodal Entailment
Colab notebook for Google Research recognizing-multimodal-entailment dataset. A Tensorflow Keras baseline model authored by Sayak Paul using pre-trained ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found