Add comment why we moved finish_update to a separate loop

This commit is contained in:
Daniël de Kok 2023-02-03 14:23:04 +01:00
parent 6357d62ca2
commit ef709de8ca

View File

@ -1168,6 +1168,9 @@ class Language:
examples, examples,
): ):
eg.predicted = doc eg.predicted = doc
# Only finish the update after all component updates are done. Some
# components may share weights (such as tok2vec) and we only want
# to apply weight updates after all gradients are accumulated.
for name, proc in self.pipeline: for name, proc in self.pipeline:
if ( if (
name not in exclude name not in exclude