mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-02 19:30:19 +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 isinstance(proc, ty.TrainableComponent)
|
||||||
and proc.is_trainable
|
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:
|
if name in annotates:
|
||||||
for doc, eg in zip(
|
for doc, eg in zip(
|
||||||
_pipe(
|
_pipe(
|
||||||
|
@ -1168,6 +1168,14 @@ class Language:
|
||||||
examples,
|
examples,
|
||||||
):
|
):
|
||||||
eg.predicted = doc
|
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
|
return losses
|
||||||
|
|
||||||
def rehearse(
|
def rehearse(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user