-
-
Notifications
You must be signed in to change notification settings - Fork 611
add lookahead optimiser #969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/optimise/lookahead.jl
Outdated
state::IdDict | ||
end | ||
|
||
const MomentumOptim = Union{Momentum, RMSProp, Nesterov, ADAM, RADAM, AdaMax, ADAGrad, ADADelta, AMSGrad, NADAM} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps an AbstractOptimiser
type would help with some of the repitition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But some optimiser don't have momentum term. Maybe we also need a AbstractMomentumOptimiser
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking if we could use traits here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.julialang.org/en/v1/manual/methods/#Trait-based-dispatch-1
if you are talking about this, I guess it's possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract type OptimiserStyle end
struct Momentumlike <: OptimiserStyle end
struct NonMomentumlike <: OptimiserStyle end
has_momentum(o::Type{Descent}) = NonMomentumlike()
has_momentum(o::Type{Momentum}) = Momentumlike()
has_momentum(o::Type{Adam}) = Momentumlike()
like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like that, yeah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhairyagandhi96 I define a |
I would step back to the original problem and just add the Lookahead optimizer |
@CarloLucibello Sure! should I revert the commit to 510cfaa or 14956c2 ? |
yes please. If we want to introduce a type hierarchy for the optimizers let's first discuss it in a separate issue/PR |
@CarloLucibello Reverted. |
In the paper, I read This also needs a rebase |
I'm saying this because the specific needs of this PR, we probably need a state setter/getter API for the optimizers, so we should think of it more carefully in a separate issue/PR, then we can revisit LookAhead when we have that in place. |
891a828
to
e71b46b
Compare
e71b46b
to
328c0be
Compare
@DhairyaLGandhi rebased and updated |
sorry we droppebd the ball here. Closing since optimisers are now in Optimisers.jl |
This add the implementation of Lookahead optimiser from this paper and based on the pytorch impl