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

Improve RunningAverage reset when epoch_bound=False #2950

Conversation

sadra-barikbin
Copy link
Collaborator

@sadra-barikbin sadra-barikbin commented May 20, 2023

Description:
When epoch_bound=False, an explicit metric.reset() was required before
another engine.run. This PR gets RunningAverage to reset itself automatically.

Check list:

  • New tests are added (if a new feature is added)

@github-actions github-actions bot added the module: metrics Metrics module label May 20, 2023
@vfdev-5
Copy link
Collaborator

vfdev-5 commented May 21, 2023

Thanks for the PR @sadra-barikbin ! I left few comments and please update PR's description as it states :

This PR removes that requirement ...

but you add more code, this looks a bit misleading

…ningAverage-at-first-epoch' into Improve-reset-RunningAverage-at-first-epoch
@vfdev-5
Copy link
Collaborator

vfdev-5 commented May 22, 2023

by the way, let's simplify this code as well:

-    @trainer.on(Events.STARTED)
-    def running_avg_output_init(engine):
-        engine.state.running_avg_output = None
+   trainer.state.running_avg_output = None

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm!

@vfdev-5 vfdev-5 merged commit a99ea7f into pytorch:master May 22, 2023
@sadra-barikbin sadra-barikbin deleted the Improve-reset-RunningAverage-at-first-epoch branch May 22, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: metrics Metrics module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants