diff --git a/examples/training/rehearsal.py b/examples/training/rehearsal.py index 24b1cea00..1cdac02aa 100644 --- a/examples/training/rehearsal.py +++ b/examples/training/rehearsal.py @@ -67,7 +67,7 @@ def main(model_name, unlabelled_loc): pipe_exceptions = ["ner", "trf_wordpiecer", "trf_tok2vec"] other_pipes = [pipe for pipe in nlp.pipe_names if pipe not in pipe_exceptions] sizes = compounding(1.0, 4.0, 1.001) - with nlp.disable_pipes(*other_pipes) and warnings.catch_warnings(): + with nlp.disable_pipes(*other_pipes), warnings.catch_warnings(): # show warnings for misaligned entity spans once warnings.filterwarnings("once", category=UserWarning, module='spacy') diff --git a/examples/training/train_ner.py b/examples/training/train_ner.py index ff6029567..f64ba801a 100644 --- a/examples/training/train_ner.py +++ b/examples/training/train_ner.py @@ -59,7 +59,7 @@ def main(model=None, output_dir=None, n_iter=100): pipe_exceptions = ["ner", "trf_wordpiecer", "trf_tok2vec"] other_pipes = [pipe for pipe in nlp.pipe_names if pipe not in pipe_exceptions] # only train NER - with nlp.disable_pipes(*other_pipes) and warnings.catch_warnings(): + with nlp.disable_pipes(*other_pipes), warnings.catch_warnings(): # show warnings for misaligned entity spans once warnings.filterwarnings("once", category=UserWarning, module='spacy') diff --git a/examples/training/train_new_entity_type.py b/examples/training/train_new_entity_type.py index e8ff6802a..a14688012 100644 --- a/examples/training/train_new_entity_type.py +++ b/examples/training/train_new_entity_type.py @@ -99,7 +99,7 @@ def main(model=None, new_model_name="animal", output_dir=None, n_iter=30): pipe_exceptions = ["ner", "trf_wordpiecer", "trf_tok2vec"] other_pipes = [pipe for pipe in nlp.pipe_names if pipe not in pipe_exceptions] # only train NER - with nlp.disable_pipes(*other_pipes) and warnings.catch_warnings(): + with nlp.disable_pipes(*other_pipes), warnings.catch_warnings(): # show warnings for misaligned entity spans once warnings.filterwarnings("once", category=UserWarning, module='spacy')