Skip to content

Remove TrainerMetrics and add CSVWriter using new StatsWriter API #3108

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

Merged
merged 86 commits into from
Dec 20, 2019

Conversation

ervteng
Copy link
Contributor

@ervteng ervteng commented Dec 19, 2019

The old TrainerMetrics class provided a subset of the functionality of the Timers and the Tensorboard writing.

This PR uses the new StatsWriter API to implement a new CSV writer, and removes the TrainerMetrics class.

  • The StatsWriter API was changed slightly to write batches of stats, and to pass std and num as well (not used in TensorboardWriter and CSVWriter).
  • Limitation: The CSV writer only writes fields found during the first summary write, and ignores those after. For instance, it is possible that loss stats are not added until after the first summary step. If not, these will be ignored. I chose this behavior over, e.g., overwriting the title row as it will still include the specified required fields (inc. reward).

@ervteng ervteng closed this Dec 19, 2019
@ervteng ervteng reopened this Dec 19, 2019
@ervteng ervteng self-assigned this Dec 19, 2019
title_row.extend(keys)
writer = csv.writer(file)
writer.writerow(title_row)
self.csv_fields[category] = keys
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: redundant? You do the same before the with...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch - removed

@ervteng ervteng merged commit b04395c into master Dec 20, 2019
@delete-merged-branch delete-merged-branch bot deleted the develop-csvwriter branch December 20, 2019 23:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants