diff --git a/examples/training/train_ner.py b/examples/training/train_ner.py index 2e8241ffc..499807d23 100644 --- a/examples/training/train_ner.py +++ b/examples/training/train_ner.py @@ -52,7 +52,7 @@ def main(model=None, output_dir=None, n_iter=100): # get names of other pipes to disable them during training other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'ner'] - with nlp.disable_pipes(*other_pipes) as disabled: # only train NER + with nlp.disable_pipes(*other_pipes): # only train NER optimizer = nlp.begin_training(get_data) for itn in range(n_iter): random.shuffle(TRAIN_DATA) diff --git a/examples/training/train_new_entity_type.py b/examples/training/train_new_entity_type.py index 69ee20e04..ec1e562c6 100644 --- a/examples/training/train_new_entity_type.py +++ b/examples/training/train_new_entity_type.py @@ -86,7 +86,7 @@ def main(model=None, new_model_name='animal', output_dir=None, n_iter=50): # get names of other pipes to disable them during training other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'ner'] - with nlp.disable_pipes(*other_pipes) as disabled: # only train NER + with nlp.disable_pipes(*other_pipes): # only train NER random.seed(0) optimizer = nlp.begin_training(lambda: []) for itn in range(n_iter): diff --git a/examples/training/train_parser.py b/examples/training/train_parser.py index 8cd602bcd..30a6f6095 100644 --- a/examples/training/train_parser.py +++ b/examples/training/train_parser.py @@ -66,7 +66,7 @@ def main(model=None, output_dir=None, n_iter=1000): # get names of other pipes to disable them during training other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'parser'] - with nlp.disable_pipes(*other_pipes) as disabled: # only train parser + with nlp.disable_pipes(*other_pipes): # only train parser optimizer = nlp.begin_training(lambda: []) for itn in range(n_iter): random.shuffle(TRAIN_DATA)