lang.from_bytes does not recreate the pipeline properly #4964
-
I need to load and save pipeline as bytes. When using the following example, the pipeline that is being loaded does not have its pipeline components set. What is the right way of saving a custom pipeline to a stream and loading it back? Thank you, How to reproduce the behaviournlp = spacy.load('en_core_web_md')
with open('c\\test', 'wb') as outfile:
outfile.write(nlp.to_bytes())
# This one will detect entities properly
test = nlp('I am going to Germany')
nlp = spacy.blank('en')
with open('c:\\test', 'rb') as outfile:
nlp.from_bytes(outfile.read())
# NER has not been loaded.
test = nlp('I am going to Germany') Your Environment
|
Beta Was this translation helpful? Give feedback.
Answered by
adrianeboyd
Feb 3, 2020
Replies: 1 comment
Answer selected by
ines
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: https://spacy.io/usage/saving-loading#pipeline