Fix usage of disable_pipes

This commit is contained in:
ines 2017-10-27 00:31:30 +02:00
parent b7b285971f
commit f81cc0bd1c
3 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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)