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

Loads metric states from state_dict #202

Merged
merged 6 commits into from Apr 27, 2021
Merged

Conversation

hlin09
Copy link
Contributor

@hlin09 hlin09 commented Apr 26, 2021

The persistent metric states are output in state_dict, but cannot be properly loaded through load_state_dict(). This PR adds handling to loading persisted metric states from state_dict and a unit test.

@Borda Borda added the enhancement New feature or request label Apr 26, 2021
Copy link
Contributor

@ananthsub ananthsub left a comment

Choose a reason for hiding this comment

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

this lgtm - @SkafteNicki what do you think?

torchmetrics/metric.py Outdated Show resolved Hide resolved
Copy link
Member

@SkafteNicki SkafteNicki left a comment

Choose a reason for hiding this comment

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

LGTM

torchmetrics/metric.py Outdated Show resolved Hide resolved
SkafteNicki and others added 4 commits April 27, 2021 09:54
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
@Borda Borda enabled auto-merge (squash) April 27, 2021 09:41
@codecov
Copy link

codecov bot commented Apr 27, 2021

Codecov Report

Merging #202 (5578ec9) into master (d432d3d) will decrease coverage by 8.43%.
The diff coverage is 28.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #202      +/-   ##
==========================================
- Coverage   96.65%   88.22%   -8.44%     
==========================================
  Files         180      180              
  Lines        5738     5740       +2     
==========================================
- Hits         5546     5064     -482     
- Misses        192      676     +484     
Flag Coverage Δ
Linux 79.75% <28.57%> (-0.14%) ⬇️
Windows 79.75% <28.57%> (-0.14%) ⬇️
cpu 79.75% <28.57%> (-16.90%) ⬇️
gpu 96.66% <ø> (+<0.01%) ⬆️
macOS 79.75% <28.57%> (-16.90%) ⬇️
pytest 88.22% <28.57%> (-8.44%) ⬇️
python3.6 ?
python3.8 ?
python3.9 ?
torch1.3.1 ?
torch1.4.0 ?
torch1.8.1 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
torchmetrics/metric.py 55.31% <28.57%> (-39.91%) ⬇️
torchmetrics/utilities/distributed.py 22.85% <0.00%> (-74.29%) ⬇️
torchmetrics/classification/auc.py 47.61% <0.00%> (-52.39%) ⬇️
torchmetrics/functional/classification/auroc.py 46.15% <0.00%> (-40.01%) ⬇️
torchmetrics/functional/regression/psnr.py 60.60% <0.00%> (-36.37%) ⬇️
torchmetrics/functional/classification/accuracy.py 57.57% <0.00%> (-36.37%) ⬇️
...chmetrics/functional/classification/stat_scores.py 66.66% <0.00%> (-33.34%) ⬇️
...rics/functional/classification/confusion_matrix.py 66.66% <0.00%> (-33.34%) ⬇️
torchmetrics/utilities/checks.py 60.54% <0.00%> (-31.90%) ⬇️
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d432d3d...5578ec9. Read the comment docs.

@Borda Borda merged commit cceced6 into Lightning-AI:master Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants