espnet.optimizer package

Initialize sub package.

espnet.optimizer.pytorch

PyTorch optimizer builders.

class espnet.optimizer.pytorch.AdadeltaFactory[source]

Bases: espnet.optimizer.factory.OptimizerFactoryInterface

Adadelta factory.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

class espnet.optimizer.pytorch.AdamFactory[source]

Bases: espnet.optimizer.factory.OptimizerFactoryInterface

Adam factory.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

class espnet.optimizer.pytorch.SGDFactory[source]

Bases: espnet.optimizer.factory.OptimizerFactoryInterface

SGD factory.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

espnet.optimizer.factory

Import optimizer class dynamically.

class espnet.optimizer.factory.OptimizerFactoryInterface[source]

Bases: object

Optimizer adaptor.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

classmethod build(target, **kwargs)[source]

Initialize optimizer with python-level args.

Parameters:

target – for pytorch model.parameters(), for chainer model

Returns:

new Optimizer

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

espnet.optimizer.factory.dynamic_import_optimizer(name: str, backend: str) → espnet.optimizer.factory.OptimizerFactoryInterface[source]

Import optimizer class dynamically.

Parameters:
  • name (str) – alias name or dynamic import syntax module:class

  • backend (str) – backend name e.g., chainer or pytorch

Returns:

OptimizerFactoryInterface or FunctionalOptimizerAdaptor

espnet.optimizer.chainer

Chainer optimizer builders.

class espnet.optimizer.chainer.AdadeltaFactory[source]

Bases: espnet.optimizer.factory.OptimizerFactoryInterface

Adadelta factory.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

class espnet.optimizer.chainer.AdamFactory[source]

Bases: espnet.optimizer.factory.OptimizerFactoryInterface

Adam factory.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

class espnet.optimizer.chainer.SGDFactory[source]

Bases: espnet.optimizer.factory.OptimizerFactoryInterface

SGD factory.

static add_arguments(parser: argparse.ArgumentParser) → argparse.ArgumentParser[source]

Register args.

static from_args(target, args: argparse.Namespace)[source]

Initialize optimizer from argparse Namespace.

Parameters:
  • target – for pytorch model.parameters(), for chainer model

  • args (argparse.Namespace) – parsed command-line args

espnet.optimizer.__init__

Initialize sub package.

espnet.optimizer.parser

Common optimizer default config for multiple backends.

espnet.optimizer.parser.adadelta(parser)[source]

Add arguments.

espnet.optimizer.parser.adam(parser)[source]

Add arguments.

espnet.optimizer.parser.sgd(parser)[source]

Add arguments.