Skip to content

Conversation

@BenjaminMidtvedt
Copy link
Collaborator

@BenjaminMidtvedt BenjaminMidtvedt commented Jun 29, 2024

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:

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:

class MyApp(Application):
    def __init__(self):
        #[...]
        self.scale= LinearScheduler(0, 0.1, 1000)
        
     def forward(x):
          self.model(x * self.scale)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants