From 97c86072e53aedb13872880b9d53ffd8d4c5790f Mon Sep 17 00:00:00 2001 From: thomashacker Date: Thu, 19 Jan 2023 12:38:28 +0100 Subject: [PATCH] Fix loop --- spacy/training/loop.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spacy/training/loop.py b/spacy/training/loop.py index 44c7023d3..d7c3504fd 100644 --- a/spacy/training/loop.py +++ b/spacy/training/loop.py @@ -221,12 +221,13 @@ def train_while_improving( exclude=exclude, annotates=annotating_components, ) - nlp.rehearse( - subbatch, - losses=losses, - sgd=False, # type: ignore[arg-type] - exclude=exclude, - ) + if use_rehearse: + nlp.rehearse( + subbatch, + losses=losses, + sgd=False, # type: ignore[arg-type] + exclude=exclude, + ) # TODO: refactor this so we don't have to run it separately in here for name, proc in nlp.pipeline: if (