Why does displacy raise a warning when rendering Docs parsed using a Stanza language model via spacy-stanza? #7354
-
Hey! I used spacy-stanza to load a Stanza language model for Finnish into spaCy. I then applied the model to some texts to get a Doc object. I then used the I then wanted to visualise the syntactic dependencies for the first Span in the list. # Import the displacy submodule
from spacy import displacy
# Use the render function to render the first item [0] in the list 'sents_fi'.
# Pass the argument 'style' with the value 'dep' to visualise syntactic dependencies.
displacy.render(sents_fi[0], style='dep') This works just fine, but raises the following warning:
Any idea what causes this warning? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is a relatively cryptic error that you can safely ignore or filter if you're just using displacy. I think we should consider filtering it out ourselves with displacy, since it's really confusing. What's going on underneath in case you're interested: |
Beta Was this translation helpful? Give feedback.
This is a relatively cryptic error that you can safely ignore or filter if you're just using displacy. I think we should consider filtering it out ourselves with displacy, since it's really confusing.
What's going on underneath in case you're interested:
spacy-stanza
add user hooks for token vectors if the stanza model includes pretrained word embeddings. As an internal processing step, displacy serializes the doc withdoc.to_bytes
, which is what leads to this warning, since it can't serialize the user hooks.