espnet.nets.chainer_backend.transformer.training.CustomUpdater
Less than 1 minute
espnet.nets.chainer_backend.transformer.training.CustomUpdater
class espnet.nets.chainer_backend.transformer.training.CustomUpdater(train_iter, optimizer, converter, device, accum_grad=1)
Bases: StandardUpdater
Custom updater for chainer.
- Parameters:
- train_iter (iterator | dict *[*str , iterator ]) – Dataset iterator for the training dataset. It can also be a dictionary that maps strings to iterators. If this is just an iterator, then the iterator is registered by the name
'main'
. - optimizer (optimizer | dict *[*str , optimizer ]) – Optimizer to update parameters. It can also be a dictionary that maps strings to optimizers. If this is just an optimizer, then the optimizer is registered by the name
'main'
. - converter (espnet.asr.chainer_backend.asr.CustomConverter) – Converter function to build input arrays. Each batch extracted by the main iterator and the
device
option are passed to this function.chainer.dataset.concat_examples()
is used by default. - device (int or dict) – The destination device info to send variables. In the case of cpu or single gpu, device=-1 or 0, respectively. In the case of multi-gpu, device={“main”:0, “sub_1”: 1, …}.
- accum_grad (int) – The number of gradient accumulation. if set to 2, the network parameters will be updated once in twice, i.e. actual batchsize will be doubled.
- train_iter (iterator | dict *[*str , iterator ]) – Dataset iterator for the training dataset. It can also be a dictionary that maps strings to iterators. If this is just an iterator, then the iterator is registered by the name
Initialize Custom Updater.
update()
Update step for Custom Updater.
update_core()
Process main update routine for Custom Updater.