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

Make optimizer state public #2561

Merged
merged 3 commits into from
Nov 28, 2024
Merged

Make optimizer state public #2561

merged 3 commits into from
Nov 28, 2024

Conversation

ArthurBrussee
Copy link
Contributor

For some use cases, it helps to do surgery on the internal optimizer state (in my case - I dynamicall add parameters, and want to add zero's as the momenta for these).

This could be done by going from optimizer -> record -> state, doing the modifications, and going back to an optimizer. A dedicate API could also work but just exposing fields seems simplest.

Also remove the Backend bound on WeightDecay - it doesn't make much sense to have WeightDecay be a FloatElement, and it complicates all bounds. AdamW already used a f32 for decay, so matching that.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.37%. Comparing base (9d073e7) to head (522c414).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2561      +/-   ##
==========================================
- Coverage   82.38%   82.37%   -0.01%     
==========================================
  Files         825      825              
  Lines      105659   105643      -16     
==========================================
- Hits        87042    87026      -16     
  Misses      18617    18617              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

LGTM!

One small note, but I'll approve in advance.

Also CI issues will be fixed with #2562

crates/burn-core/src/optim/decay.rs Show resolved Hide resolved
@laggui laggui merged commit 6f494e5 into tracel-ai:main Nov 28, 2024
8 of 9 checks passed
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