Don't warn about components not in the pipeline

See here:

https://github.com/explosion/spaCy/discussions/7463

Still need to check if there are any side effects of listeners being
present but not in the pipeline, but this commit will silence the
warnings.
This commit is contained in:
Paul O'Leary McCann 2021-03-17 14:56:04 +09:00
parent 61472e7cb3
commit ef77c88638
1 changed files with 4 additions and 0 deletions

View File

@ -74,6 +74,10 @@ def init_nlp(config: Config, *, use_gpu: int = -1) -> "Language":
for name, proc in nlp.pipeline:
if getattr(proc, "listening_components", None): # e.g. tok2vec/transformer
for listener in proc.listening_components:
# Don't warn about components not in the pipeline
if listener not in nlp.pipeline:
continue
if listener in frozen_components and name not in frozen_components:
logger.warning(Warnings.W087.format(name=name, listener=listener))
# We always check this regardless, in case user freezes tok2vec