Deserialization fails with a new model instance.
See original GitHub issueRunning the following code results in an error:
import spacy
import en_core_web_md
nlp = en_core_web_md.load()
doc = nlp(u'North America United States Communications Equipment (GICS) Handheld Devices (Citi)')
serialized = doc.to_bytes()
new_nlp = en_core_web_md.load()
new_doc = spacy.tokens.doc.Doc(new_nlp.vocab)
new_doc.from_bytes(serialized)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-53-d77de8988116> in <module>()
7 new_nlp = en_core_web_md.load()
8 new_doc = spacy.tokens.doc.Doc(new_nlp.vocab)
----> 9 new_doc.from_bytes(serialized)
/data/anaconda3/lib/python3.6/site-packages/spacy/tokens/doc.pyx in spacy.tokens.doc.Doc.from_bytes (spacy/tokens/doc.cpp:12323)()
/data/anaconda3/lib/python3.6/site-packages/spacy/serialize/packer.pyx in spacy.serialize.packer.Packer.unpack_into (spacy/serialize/packer.cpp:6258)()
/data/anaconda3/lib/python3.6/site-packages/spacy/serialize/packer.pyx in spacy.serialize.packer.Packer._char_decode (spacy/serialize/packer.cpp:7791)()
/data/anaconda3/lib/python3.6/site-packages/spacy/tokens/doc.pyx in spacy.tokens.doc.Doc.push_back (spacy/tokens/doc.cpp:10057)()
AssertionError:
Your Environment
- Operating System: Ubuntu 14.04.5 LTS
- Python Version Used: 3.6 (anaconda)
- spaCy Version Used: 1.7.2
- Environment Information:
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Jackson deserialization fails after serializing an object using ...
ObjectMapper class(com.fasterxml.jackson.core:jackson-databind:2.9.5) I am trying to deserialize an object of the following class:
Read more >Strange error with JSON serialize/deserialize
I'm seeing some weird behavior while trying to deserialize json containing some Accounts with child objects. Example code:
Read more >Deserialization failing randomly - Google Groups
The problem you encountered, serialization succeeds but deserialization doesn't, can be caused by a bug in the serializers. If any serializer reads the...
Read more >Object Serialization Enhancements in Previous Releases
The new support is provided by the following API additions in package java.io: ... Bug fix: Deserialization fails for Class object of primitive...
Read more >Serializers - Django REST framework - Tom Christie
Serializers allow complex data such as querysets and model instances to be converted to ... When deserializing data, we can either create a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing this and making #1045 the master issue. Work in progress for spaCy v2.0!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.