Catch PyTorch warning when saving/loading scheduler#7401
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7401 +/- ##
==========================================
+ Coverage 77.06% 79.35% +2.28%
==========================================
Files 181 181
Lines 35781 35793 +12
==========================================
+ Hits 27575 28403 +828
+ Misses 8206 7390 -816
Continue to review full report at Codecov.
|
|
worth pushing upstream to |
|
We can certainly file an issue about it but my guess is that they though a warning always passed was fine (since there is no way to know if the user is saving/loading the optimizer with its scheduler). |
|
Thanks for this! Regarding whether to push upstream to pytorch: |
When saving or loading the scheduler, PyTorch always sends a warning to save/load the optimizer state as well (with a typo). We are saving/loading the optimizer state along the scheduler but there is no way to tell that to PyTorch and avoid the annoying warning (and its typo).
This PR fixes that by catching all warnings while loading/saving the scheduler then reissuing the non-expected ones.