-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
sanitize arrays when logging as hyperparameters in TensorBoardLogger #9031
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9031 +/- ##
=======================================
- Coverage 93% 89% -4%
=======================================
Files 175 175
Lines 14457 14462 +5
=======================================
- Hits 13406 12811 -595
- Misses 1051 1651 +600 |
Co-authored-by: Justus Schock <[email protected]>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat !
@@ -286,6 +287,12 @@ def _get_next_version(self): | |||
|
|||
return max(existing_versions) + 1 | |||
|
|||
@staticmethod | |||
def _sanitize_params(params: Dict[str, Any]) -> Dict[str, Any]: | |||
params = LightningLoggerBase._sanitize_params(params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For later, should we move this out as a utility function? Are there opportunities for consolidation with other hyper parameter saving logic the framework has?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can but keep in mind not all loggers have the same level of support and flexibility so sanitization, flattening etc. is generally speaking always subject to the individual logger.
Are there opportunities for consolidation with other hyper parameter saving logic the framework has?
not any I know of
What does this PR do?
Fixes #9022
TensorBoardLogger can log hyperparameters but not all types of data. It can do arrays that are 1-dimensional but anything higher-dimensional not, so we will sanitize it by converting to string as we do with other unsupported types.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
I made sure I had fun coding 🙃