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.

Deserialization fails with a new model instance.

See original GitHub issue

Running 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:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
inescommented, May 7, 2017

Closing this and making #1045 the master issue. Work in progress for spaCy v2.0!

0reactions
lock[bot]commented, May 8, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

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