dgs.models.scheduler.register_scheduler

dgs.models.scheduler.register_scheduler(sched_name: str, scheduler: Type[torch.optim.lr_scheduler.LRScheduler]) None[source]

Register a new learning-rate scheduler to be used with custom configs.

Parameters:
  • sched_name – Name of the new scheduler, e.g. “StepwiseIncrement”. The name cannot be a value already present in SCHEDULERS.

  • scheduler – The type / class of the learning rate scheduler to register.

Raises:

ValueError – If sched_name is in SCHEDULERS.keys() or the scheduler is invalid.

Examples:

from dgs.utils.types import Scheduler
class CustomLinear(Scheduler):
    ...
register_scheduler("CustomLinear", CustomLinear)