Open BenjaminMidtvedt opened 3 months ago
This PR adds schedulers for scalar values (only floats so far) to deeplay. They can be used in place of any scalar float without any change to the forward pass. For example:
betaVAE_const = BetaVAE(beta=0.1) betaVAE_sched = BetaVAE(beta=LinearScheduler(0, 0.1, 1000))
You can also use the methods schedule, schedule_linear, schedule_loglinear to schedule any number, even if it is not a part of the constructor:
schedule
schedule_linear
schedule_loglinear
betaVAE = BetaVAE() betaVAE.schedule(beta=LinearScheduler(0, 0.1, 1000)) betaVAE.schedule_linear("beta", 0, 0.1, 100) betaVAE.schedule_loglinear("beta", 0.01, 0.1, 100)
They can also trivially be used in the __init__ function:
__init__
class MyApp(Application): def __init__(self): #[...] self.scale= LinearScheduler(0, 0.1, 1000) def forward(x): self.model(x * self.scale)
This PR adds schedulers for scalar values (only floats so far) to deeplay. They can be used in place of any scalar float without any change to the forward pass. For example:
You can also use the methods
schedule
,schedule_linear
,schedule_loglinear
to schedule any number, even if it is not a part of the constructor:They can also trivially be used in the
__init__
function: