mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-13 10:46:29 +03:00
Fix usage of disable_pipes
This commit is contained in:
parent
b7b285971f
commit
f81cc0bd1c
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user