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

Add persistent flag to Metric.add_state #4195

Merged
merged 6 commits into from Oct 16, 2020
Merged

Conversation

teddykoker
Copy link
Contributor

What does this PR do?

Adds persistent flag to Metrics, to allow the user to disable state being
added to the state_dict.

@mergify mergify bot requested a review from a team October 16, 2020 14:45
@pep8speaks
Copy link

pep8speaks commented Oct 16, 2020

Hello @teddykoker! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-10-16 16:16:47 UTC

@SkafteNicki
Copy link
Member

Can we add test for this? One metric class with and one without the persistent flag on their state, and then check their state dict.

@teddykoker
Copy link
Contributor Author

Can we add test for this? One metric class with and one without the persistent flag on their state, and then check their state dict.

Done :)

@Borda Borda added feature Is an improvement or enhancement Metrics labels Oct 16, 2020
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

lgtm

@mergify mergify bot requested a review from a team October 16, 2020 16:17
@codecov
Copy link

codecov bot commented Oct 16, 2020

Codecov Report

Merging #4195 into master will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #4195   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         103     103           
  Lines        7844    7847    +3     
======================================
+ Hits         7277    7280    +3     
  Misses        567     567           

@mergify mergify bot requested a review from a team October 16, 2020 17:08
@teddykoker teddykoker merged commit 827a557 into master Oct 16, 2020
@teddykoker teddykoker deleted the persistant_metrics branch October 16, 2020 18:36
@Borda Borda added this to the 1.0.x milestone Oct 20, 2020
@Borda Borda added this to in Progress in Metrics package via automation Nov 8, 2020
@Borda Borda moved this from in Progress to Done in Metrics package Nov 8, 2020
@Vichoko
Copy link
Contributor

Vichoko commented Nov 13, 2020

Why would someone want to save a metric to the state_dict?
When you add metrics to the state_dict by default, you cannot load checkpoints any longer after you make changes to any of the metrics.

I feel pretty natural to add or update metrics of an already trained module. For example, adding the new metrics from the ptl.metrics module in the test loop and running the trainer in test mode fails catastrophically. Just like in my issue #4666 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants