espnet3.components.modeling.optimization_spec.SchedulerSpec
espnet3.components.modeling.optimization_spec.SchedulerSpec
class espnet3.components.modeling.optimization_spec.SchedulerSpec(name: str, scheduler: Any, interval: str = 'epoch', monitor: str | None = None)
Bases: object
Describe one named scheduler block from config.schedulers.
This is the normalized, validated form of user-facing scheduler metadata. Scheduler config example.
schedulers:
generator:
scheduler:
_target_: torch.optim.lr_scheduler.LinearLR
total_iters: 1000
interval: stepAnother example.
schedulers:
discriminator:
scheduler:
_target_: torch.optim.lr_scheduler.ReduceLROnPlateau
patience: 2
interval: epoch
monitor: valid/discriminator/lossLike OptimizerSpec, this stores configuration, not the instantiated scheduler object. The Lightning module uses it to decide whether a scheduler should step on each optimizer update or at epoch end, and which logged metric to pass when a monitored epoch-based scheduler is used.
classmethod from_config(name: str, cfg) → SchedulerSpec
Build and validate a scheduler spec from one named config block.
This converts raw Hydra/OmegaConf config into a typed SchedulerSpec instance, applies dataclass defaults for omitted optional fields, and validates interval-level rules before the Lightning module instantiates the real scheduler objects.
interval : str = 'epoch'
monitor : str | None = None
name : str
scheduler : Any
validate() → None
Validate scheduler stepping policy after normalization.
Only spec-local checks are performed here. Cross-object rules, such as matching optimizer and scheduler names exactly, are validated later by the Lightning module once all specs have been collected.
