Skip to content
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

Rule for gradient accumulation #137

Merged
merged 12 commits into from
Apr 12, 2023
Merged

Rule for gradient accumulation #137

merged 12 commits into from
Apr 12, 2023

Conversation

CarloLucibello
Copy link
Member

Fix #130

PR Checklist

  • Tests are added
  • Documentation, if applicable

src/rules.jl Outdated Show resolved Hide resolved
test/rules.jl Outdated Show resolved Hide resolved
src/rules.jl Outdated Show resolved Hide resolved
src/interface.jl Outdated Show resolved Hide resolved
src/rules.jl Outdated Show resolved Hide resolved
test/rules.jl Outdated
x0 = rand(5)
x = copy(x0)
lr = 0.01
tree = Optimisers.setup(AccumGrad(Descent(lr), 3), x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A torture test would use something with a large momentum, so that it fails if the rule is applied 3 times, rather that once for the total gradient. But not sure that's necessary.

test/rules.jl Show resolved Hide resolved
src/rules.jl Show resolved Hide resolved
src/rules.jl Outdated Show resolved Hide resolved
src/rules.jl Outdated Show resolved Hide resolved
src/rules.jl Outdated Show resolved Hide resolved
CarloLucibello and others added 2 commits April 12, 2023 09:07
Co-authored-by: Michael Abbott <32575566+mcabbott@users.noreply.github.com>
@CarloLucibello CarloLucibello merged commit e6d8160 into master Apr 12, 2023


"""
AccumGrad(n::Int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo for rendering

Suggested change
AccumGrad(n::Int)
AccumGrad(n::Int)

@CarloLucibello CarloLucibello deleted the cl/accum2 branch March 31, 2024 15:33
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.

Interface for gradient accumulation
3 participants