core.scheduler#

The scheduler module contains schedulers to schedule changing hyperparameters during training.

Schedulers can be saved and loaded to allow for checkpointing of the complete training process.

class soulsai.core.scheduler.Scheduler#

Base class for schedulers.

All schedulers should inherit from this class and implement the forward and update methods.

__init__()#

Initialize the scheduler.

forward() FloatTensor#

Calculate the value at the current step.

Returns:

The value at the current step.

update(x: int = 1)#

Advance the scheduler.

Parameters:

x – Number of steps to advance the scheduler. Defaults to 1.

class soulsai.core.scheduler.LinearScheduler(start: list[float], end: list[float], steps: int)#

Linear scheduler to linearly change a value from start to end over a given number of steps.

The scheduler can be used to decay hyperparameters during training, such as the exploration rate of an epsilon-greedy policy.

__init__(start: list[float], end: list[float], steps: int)#

Initialize the linear scheduler.

Parameters:
  • start – The start value of the scheduler.

  • end – The end value of the scheduler.

  • steps – The number of steps to reach the end value.

forward() FloatTensor#

Calculate the value at the current decay step.

Returns:

The value at the current decay step.

update(n: int = 1)#

Advance the scheduler.

Parameters:

n – Number of steps to advance the scheduler. Defaults to 1.