-
-
Notifications
You must be signed in to change notification settings - Fork 617
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
HPO logger handler #3061
base: master
Are you sure you want to change the base?
HPO logger handler #3061
Conversation
|
||
from ignite.engine import Engine, Events | ||
|
||
_DEFAULT_METRIC_PATH = '/tmp/hypertune/output.metrics' |
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.
I wonder whether this code could run on windows. If yes, we may need to provide OS-agnostic path using python tempfile module.
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.
this is the path where the listener of the GCP HPO orchestration has a look. Whatever is dumped here (in terms of metric values) becomes visible to the Vertex platform. I found this path here https://github.com/GoogleCloudPlatform/cloudml-hypertune/blob/8e3530e1c4926ac64cf28330d1104b838e07a468/hypertune/hypertune.py#L24
Should we keep it?
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.
Thanks for the PR @St3V0Bay !
Can you please run this script to reformat the code to our format:
bash ./tests/run_code_style.sh install
bash ./tests/run_code_style.sh fmt
and let's also run mypy:
bash ./tests/run_code_style.sh mypy
def __init__( | ||
self, | ||
evaluator: Engine | None = None, | ||
metric_tag: UserString = 'training/hptuning/metric' |
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.
Can't we use str
here ?
metric_tag: UserString = 'training/hptuning/metric' | |
metric_tag: str = 'training/hptuning/metric' |
Args: | ||
engine: Ignite Engine, it can be a trainer, validator or evaluator. | ||
""" | ||
with self.lock: |
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.
why do we need a lock here ?
self.metrics.clear() | ||
self.metrics.update(state_dict[MetricLoggerKeys.METRICS]) | ||
|
||
hpologger = HPOLogger() |
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.
I think we can remove this line.
|
||
class HPOLogger(object): | ||
""" | ||
Makes selected metric accessible for use by GCP Vertex AI hyperparameter tuning jobs. By adding only this |
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.
Can you please add a link to GCP Vertex AI as
`GCP Vertex AI <link>`_
|
||
Args: | ||
evaluator: Evaluator to consume metric results from at the end of its evaluation run | ||
metric_tag: Converts the metric value coming from the trainer/evaluator's state into a storable value |
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.
Below this line we need to add .. versionadded:: 0.5.0
tag.
See https://github.com/pytorch/ignite/blob/master/CONTRIBUTING.md#writing-documentation for details
Fixes #3023
Description:
Check list: