mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-02 03:10:22 +03:00
Language.update: call pipe finish_update after all pipe updates
This does correct and fast updates if multiple components update the same parameters.
This commit is contained in:
parent
7753b88e0d
commit
6357d62ca2
|
@ -1155,7 +1155,7 @@ class Language:
|
|||
and isinstance(proc, ty.TrainableComponent)
|
||||
and proc.is_trainable
|
||||
):
|
||||
proc.update(examples, sgd=sgd, losses=losses, **component_cfg[name])
|
||||
proc.update(examples, sgd=None, losses=losses, **component_cfg[name])
|
||||
if name in annotates:
|
||||
for doc, eg in zip(
|
||||
_pipe(
|
||||
|
@ -1168,6 +1168,14 @@ class Language:
|
|||
examples,
|
||||
):
|
||||
eg.predicted = doc
|
||||
for name, proc in self.pipeline:
|
||||
if (
|
||||
name not in exclude
|
||||
and isinstance(proc, ty.TrainableComponent)
|
||||
and proc.is_trainable
|
||||
):
|
||||
proc.finish_update(sgd)
|
||||
|
||||
return losses
|
||||
|
||||
def rehearse(
|
||||
|
|
Loading…
Reference in New Issue
Block a user