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 .init() method of LR schedulers return Result #2527

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

towerpark
Copy link
Contributor

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

run-checks script was executed with DISABLE_WGPU=1, because otherwise I would get an unrelated error similar to #1477.

Related Issues/PRs

Fix #2510

Changes

  • Make .init() method of LR schedulers return Result instead of panicking for invalid configuration.
    Add check and test code for Noam LR scheduler accordingly.
    ConstantLr is not changed because there is nothing to check.

  • Update affected examples (text-generation & text-classification).

  • Clean up related test code (eliminate unnecessary constants and helper function)

Testing

  • Ensured that DISABLE_WGPU=1 bash ./run-checks.sh ran with no error
  • Checked documentation by reading it in a browser
  • Confirmed by grep-ing "scheduler" in the source code that the Books were not affected

* Make `.init()` return `Result` instead of panicking for all the
  schedulers except `ConstantLr`, which has nothing to check.

* Update affected examples

* Add check and test code for Noam LR scheduler

* Clean up test code
Copy link

codecov bot commented Nov 23, 2024

Codecov Report

Attention: Patch coverage is 92.55319% with 14 lines in your changes missing coverage. Please review.

Project coverage is 82.60%. Comparing base (9c31f75) to head (37e5a9e).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/burn-core/src/lr_scheduler/cosine.rs 89.36% 5 Missing ⚠️
crates/burn-core/src/lr_scheduler/linear.rs 88.37% 5 Missing ⚠️
crates/burn-core/src/lr_scheduler/exponential.rs 87.87% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2527    +/-   ##
========================================
  Coverage   82.59%   82.60%            
========================================
  Files         827      827            
  Lines      106712   106821   +109     
========================================
+ Hits        88143    88238    +95     
- Misses      18569    18583    +14     

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


🚨 Try these New Features:

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! Thanks for making this change 🙂

@laggui laggui merged commit 23a6504 into tracel-ai:main Nov 25, 2024
11 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.

LR Scheduler init should return Result<Scheduler, ...> instead of panicking
2 participants