Python chainer.training.extension.Extension() Examples
The following are 4
code examples of chainer.training.extension.Extension().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
chainer.training.extension
, or try the search function
.
Example #1
Source File: asr_utils.py From espnet with Apache License 2.0 | 6 votes |
def adadelta_eps_decay(eps_decay): """Extension to perform adadelta eps decay. Args: eps_decay (float): Decay rate of eps. Returns: An extension function. """ @training.make_extension(trigger=(1, "epoch")) def adadelta_eps_decay(trainer): _adadelta_eps_decay(trainer, eps_decay) return adadelta_eps_decay
Example #2
Source File: asr_utils.py From espnet with Apache License 2.0 | 6 votes |
def adam_lr_decay(eps_decay): """Extension to perform adam lr decay. Args: eps_decay (float): Decay rate of lr. Returns: An extension function. """ @training.make_extension(trigger=(1, "epoch")) def adam_lr_decay(trainer): _adam_lr_decay(trainer, eps_decay) return adam_lr_decay
Example #3
Source File: asr_utils.py From espnet with Apache License 2.0 | 5 votes |
def restore_snapshot(model, snapshot, load_fn=chainer.serializers.load_npz): """Extension to restore snapshot. Returns: An extension function. """ @training.make_extension(trigger=(1, "epoch")) def restore_snapshot(trainer): _restore_snapshot(model, snapshot, load_fn) return restore_snapshot
Example #4
Source File: asr_utils.py From espnet with Apache License 2.0 | 5 votes |
def torch_snapshot(savefun=torch.save, filename="snapshot.ep.{.updater.epoch}"): """Extension to take snapshot of the trainer for pytorch. Returns: An extension function. """ @extension.make_extension(trigger=(1, "epoch"), priority=-100) def torch_snapshot(trainer): _torch_snapshot_object(trainer, trainer, filename.format(trainer), savefun) return torch_snapshot