mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
b734e5314d
* Avoid `TrainablePipe.finish_update` getting called twice during training PR #12136 fixed an issue where the tok2vec pipe was updated before gradient were accumulated. However, it introduced a new bug that cause `finish_update` to be called twice when using the training loop. This causes a fairly large slowdown. The `Language.update` method accepts the `sgd` argument for passing an optimizer. This argument has three possible values: - `Optimizer`: use the given optimizer to finish pipe updates. - `None`: use a default optimizer to finish pipe updates. - `False`: do not finish pipe updates. However, the latter option was not documented and not valid with the existing type of `sgd`. I assumed that this was a remnant of earlier spaCy versions and removed handling of `False`. However, with that change, we are passing `None` to `Language.update`. As a result, we were calling `finish_update` in both `Language.update` and in the training loop after all subbatches are processed. This change restores proper handling/use of `False`. Moreover, the role of `False` is now documented and added to the type to avoid future accidents. * Fix typo * Document defaults for `Language.update` |
||
---|---|---|
.. | ||
converters | ||
__init__.pxd | ||
__init__.py | ||
align.pyx | ||
alignment_array.pxd | ||
alignment_array.pyx | ||
alignment.py | ||
augment.py | ||
batchers.py | ||
callbacks.py | ||
corpus.py | ||
example.pxd | ||
example.pyx | ||
gold_io.pyx | ||
initialize.py | ||
iob_utils.py | ||
loggers.py | ||
loop.py | ||
pretrain.py |