Training loop abstraction

Chainer provides a standard implementation of the training loops under the chainer.training module. It is built on top of many other core features of Chainer, including Variable and Function, Link/Chain/ChainList, Optimizer, Dataset, and Reporter/Summary. Compared to the training loop abstraction of other machine learning tool kits, Chainer’s training framework aims at maximal flexibility, while keeps the simplicity for the typical usages. Most components are pluggable, and users can overwrite the definition.

The core of the training loop abstraction is Trainer, which implements the training loop itself. The training loop consists of two parts: one is Updater, which actually updates the parameters to train, and the other is Extension for arbitrary functionalities other than the parameter update.

Updater and some extensions use chainer.dataset and Iterator to scan the datasets and load mini batches. The trainer also uses Reporter to collect the observed values, and some extensions use DictSummary to accumulate them and computes the statistics.

You can find many examples for the usage of this training utilities from the official examples. You can also search the extension implementations from Trainer extensions.

Trainer

chainer.training.Trainer The standard training loop in Chainer.

Updater

chainer.training.Updater Interface of updater objects for trainers.
chainer.training.StandardUpdater Standard implementation of Updater.
chainer.training.ParallelUpdater Implementation of a parallel GPU Updater.
chainer.training.updaters.MultiprocessParallelUpdater Implementation of a multiprocess parallel GPU Updater.

Extension

chainer.training.Extension Base class of trainer extensions.
chainer.training.make_extension Decorator to make given functions into trainer extensions.

Trigger

Trigger is a callable object to decide when to process some specific event within the training loop. It takes a Trainer object as the argument, and returns True if some event should be fired.

It is mainly used to determine when to call an extension. It is also used to determine when to quit the training loop.

chainer.training.get_trigger Gets a trigger object.