Skip to content

Improve RunningAverage reset when epoch_bound=False#2950

Merged
vfdev-5 merged 5 commits intopytorch:masterfrom
sadra-barikbin:Improve-reset-RunningAverage-at-first-epoch
May 22, 2023
Merged

Improve RunningAverage reset when epoch_bound=False#2950
vfdev-5 merged 5 commits intopytorch:masterfrom
sadra-barikbin:Improve-reset-RunningAverage-at-first-epoch

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