mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Fix multiple context manages in examples (#5690)
This commit is contained in:
parent
6bc643d2e2
commit
2bd78c39e3
|
@ -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')
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user