noether.core.factory.optimizer

Classes

OptimizerFactory

Factory for creating optimizers. Handles wrapping into OptimizerWrapper by creating the corresponding constructor

Module Contents

class noether.core.factory.optimizer.OptimizerFactory

Bases: noether.core.factory.base.Factory

Factory for creating optimizers. Handles wrapping into OptimizerWrapper by creating the corresponding constructor for the underlying torch.optim.Optimizer. Objects are returned as partials, as creating the optimizer requires the model parameters from the instantiated model.

instantiate(optimizer_config)

Instantiates the optimizer based on the provided configuration.

Parameters:

optimizer_config (noether.core.schemas.optimizers.OptimizerConfig) – Configuration for the optimizer to create. This config contains both the torch.optim.Optimizer and the OptimizerWrapper configurations. Optimizer and the OptimizerWrapper configurations. See OptimizerConfig for available options.

Returns:

A callable that initializes the OptimizerWrapper.

Return type:

collections.abc.Callable[Ellipsis, noether.core.optimizer.OptimizerWrapper]