spaCy/spacy/pipeline
Matthew Honnibal 73e095923f 💫 Improve error message when model.from_bytes() dies (#4014)
* Improve error message when model.from_bytes() dies

When Thinc's model.from_bytes() is called with a mismatched model, often
we get a particularly ungraceful error,

e.g. "AttributeError: FunctionLayer has no attribute G"

This is because we're trying to load the parameters for something like
a LayerNorm layer, and the model architecture has some other layer there
instead. This is obviously terrible, especially since the error *type*
is wrong.

I've changed it to raise a ValueError. The error message is still
probably a bit terse, but it's hard to be sure exactly what's gone
wrong.

* Update spacy/pipeline/pipes.pyx

* Update spacy/pipeline/pipes.pyx

* Update spacy/pipeline/pipes.pyx

* Update spacy/syntax/nn_parser.pyx

* Update spacy/syntax/nn_parser.pyx

* Update spacy/pipeline/pipes.pyx

Co-Authored-By: Matthew Honnibal <honnibal+gh@gmail.com>

* Update spacy/pipeline/pipes.pyx

Co-Authored-By: Matthew Honnibal <honnibal+gh@gmail.com>


Co-authored-by: Ines Montani <ines@ines.io>
2019-07-24 11:27:34 +02:00
..
__init__.py Merge branch 'master' into feature/el-framework 2019-03-26 11:00:02 +01:00
entityruler.py Improve EntityRuler serialization 2019-07-10 12:25:45 +02:00
functions.py Tidy up and improve docs and docstrings (#3370) 2019-03-08 11:42:26 +01:00
hooks.py 💫 Add better and serializable sentencizer (#3471) 2019-03-23 15:45:02 +01:00
pipes.pyx 💫 Improve error message when model.from_bytes() dies (#4014) 2019-07-24 11:27:34 +02:00