k1lib.schedule module¶
This module allows you to make and combine a bunch of schedules, and setup the optimizer so that it changes hyperparameter values based on the schedule. Highly recommend you check out the tutorials section on this.
-
class
k1lib.schedule.
Fn
(f: Callable[[float], float], param: Optional[str] = None)[source]¶ Bases:
object
-
__init__
(f: Callable[[float], float], param: Optional[str] = None)[source]¶ Creates a new schedule based on some custom function. Example:
s = schedule.Fn(lambda x: x**2) # you can also use this as a decorator @schedule.Fn def s(x): return x**2
- Parameters
f – domain should always in [0, 1]
param – (optional) Parameter to schedule (e.g “lr”) if using
ParamScheduler
-
property
value
¶
-
-
k1lib.schedule.
linear
(low, high, param: Optional[str] = None)[source]¶ Sharply goes from low to high
-
k1lib.schedule.
smooth
(low, high, param: Optional[str] = None)[source]¶ Smoothly goes from low to high
-
k1lib.schedule.
hump
(low, high, param: Optional[str] = None)[source]¶ Smoothly rises up (30%), then down (70%)
-
k1lib.schedule.
exp
(low, high, param: Optional[str] = None)[source]¶ Rises/drops quickly, then rate of change gets smaller and smaller
-
class
k1lib.schedule.
ParamScheduler
(css: str, *schedules: List[k1lib.schedule.Fn])[source]¶ Bases:
k1lib.callbacks.callbacks.Callback
Schedules a param in parts of the network.
- Parameters
css – the selected parts of the network to schedule
schedules – (obvious)
-
startRun
()¶ Schedules a param in parts of the network.
- Parameters
css – the selected parts of the network to schedule
schedules – (obvious)