spaCy: Error running Keras entailment example

Hi Guys I’m trying to run the Parikh example, and when running the test using

py.test keras_parikh_entailment/keras_decomposable_attention.py

I get an error

ValueError: You calledset_weights(weights) on layer "embed" with a weight list of length 1, but the layer was expecting 0 weights. Provided weights: [array([[ 0.00000000e+00, 0.00000000e+00, 1.4...

I’ve tried a couple of different environments (python 2.7 and 3.5, CPU & GPU).

I updated to the most recent versions of Keras and Spacy. Tried on both Mac and Ubuntu.

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Running into some issues when trying to run both tests,

TypeError: call() got an unexpected keyword argument 'mask'

../../../anaconda/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/engine/topology.py:554: TypeError

The TypeError is coming from these two lines (181 & 182) of code in keras_decomposable_attention.py:

    avged = GlobalAveragePooling1D()(result, mask=self.words)
    maxed = GlobalMaxPooling1D()(result, mask=self.words)

changing it to:

    avged = GlobalAveragePooling1D()(result)  #mask=self.words
    maxed = GlobalMaxPooling1D()(result) #mask=self.words

fixes the issue and gets the tests to pass:

errorcorrect

mmacy@DuhBuntu:~/devel/spaCy/examples$ pytest keras_parikh_entailment/keras_decomposable_attention.py ========================================= test session starts ========================================== platform linux2 – Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0 rootdir: /home/mmacy/devel/spaCy, inifile: collected 2 items

keras_parikh_entailment/keras_decomposable_attention.py …

====================================== 2 passed in 21.40 seconds =======================================

@pchowdhry @jfoster17 try
% pip uninstall Keras % git clone https://github.com/fchollet/keras.git; cd keras; python setup.py build; python setup.py install

Although the code in git is still called 1.2.0, fchollet is getting ready to cut a 2.0 and has, by all appearances, fixed this in his master branch.

Hope that helps.