Closed asquare closed 2 years ago
Thanks for the heads-up, I confirmed this behavior. It's probably related to #11459.
This only happens for me when using the en_core_web_sm.load()
style of loading - there's no warning with spacy.load()
.
We'll take a look at this, but it should be safe to ignore if the behavior it warns about is what you want. You can silence this the same was as any Python warning, like so:
import warnings
# message is a prefix of the actual warning string
warnings.filterwarnings("ignore", message="[W123]")
When disabling a component with
nlp = spacy.load('en_core_web_sm', disable=['ner'])
the same error is triggered. Is this issue related?
I tried the fix suggest above with:
import warnings
warnings.filterwarnings("ignore", message="[W123]")
nlp = spacy.load('en_core_web_sm', disable=['ner'])
but it did not work. I am still getting this warning:
/Users/x/environments/python3.10.8/lib/python3.10/site-packages/spacy/language.py:1895: UserWarning: [W123] Argument disable with value ['ner'] is used instead of ['senter'] as specified in the config. Be aware that this might affect other components in your pipeline.
warnings.warn(
UPDATE: warnings.filterwarnings("ignore", message="[W123]") needs to be
warnings.filterwarnings("ignore", message="^\[W123\]")
as message filter uses regex!
Any hint on how to correctly load the model without triggering the warning? Thx!
en_core_web_sm.load()
but there are still some bugs related to the behavior of en_core_web_sm.load(disable=["ner"])
in v3.4.2.A workaround to get the intended behavior for the sm/md/lg
pipelines in v3.4.2 is to load the model like this:
nlp = spacy.load('en_core_web_sm', disable=['ner', 'senter'])
This will still produce a warning, though, and we are working on fixing both the behavior for disable=['ner']
and improving the warnings for cases that still need a warning.
If the warning is still causing problems for you and you don't need any of the modifications in v3.4.2, you can consider temporarily downgrading to v3.4.1.
To explain a bit more for anyone who comes across this issue, in v3.4.2 spacy.load("en_core_web_sm", disable=["ner"])
is doing two things:
ner
senter
, which is otherwise disabled by defaultIn spacy v3.4.1 and earlier, the same command only did (1) and not (2). Enabling senter
as a side effect is a bug, and we are working on addressing this for v3.4.3.
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.
After upgrading to
3.4.2
I see this warning on the console when a model is loaded. How to fix or silence this?How to reproduce the behaviour
Your Environment