From ef77c886388713f7651daced6c90c63165a88d6b Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Wed, 17 Mar 2021 14:56:04 +0900 Subject: [PATCH] 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. --- spacy/training/initialize.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spacy/training/initialize.py b/spacy/training/initialize.py index f7f2f21a4..d017aa909 100644 --- a/spacy/training/initialize.py +++ b/spacy/training/initialize.py @@ -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