ls_mlkit.util.scheduler module

class ls_mlkit.util.scheduler.ObjectAttrsScheduler(obj: object, attr_names: list[str], total: int, warmup_steps: int = None, warmup_ratio: float = 0, strategy: SchedulerType = SchedulerType.CONSTANT_WITH_WARMUP, setter_methods: dict[str, Callable] = None, getter_methods: dict[str, Callable] = None)[source]

Bases: object

get()[source]
step()[source]
class ls_mlkit.util.scheduler.Scheduler(info: dict[str, dict[str, Any]], total: int)[source]

Bases: object

get(key=None)[source]

Get the current value of the scheduler

Parameters:

key (str, optional) – The key of the scheduler to get. If None, return the entire scheduler info. Defaults to None.

Returns:

The entire scheduler info or the value of the scheduler for the given key

Return type:

dict[str, Any] or Any

step()[source]

Step the scheduler

class ls_mlkit.util.scheduler.SchedulerType(*values)[source]

Bases: Enum

CONSTANT_WITH_WARMUP = 'constant_with_warmup'
COSINE_DECAY_WITH_WARMUP = 'cosine_decay_with_warmup'
EXPONENTIAL_DECAY_WITH_WARMUP = 'exponential_decay_with_warmup'
LINEAR_DECAY_WITH_WARMUP = 'linear_decay_with_warmup'
ls_mlkit.util.scheduler.constant_with_warmup(value, current, total, warmup_steps=0)[source]
ls_mlkit.util.scheduler.cosine_decay_with_warmup(value, current, total, warmup_steps=0)[source]
ls_mlkit.util.scheduler.exponential_decay_with_warmup(value, current, total, warmup_steps=0, decay_rate=5.0)[source]
ls_mlkit.util.scheduler.linear_decay_with_warmup(value, current, total, warmup_steps=0)[source]