-
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
Add run_name argument to the MLFlowLogger constructor #7622
Add run_name argument to the MLFlowLogger constructor #7622
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #7622 +/- ##
=======================================
- Coverage 92% 88% -4%
=======================================
Files 197 198 +1
Lines 12878 12942 +64
=======================================
- Hits 11899 11380 -519
- Misses 979 1562 +583 |
…pytorch-lightning into mlflowlogger-accept-runname-arg
@@ -155,6 +161,14 @@ def experiment(self) -> MlflowClient: | |||
) | |||
|
|||
if self._run_id is None: | |||
if self._run_name is not None: | |||
self.tags = self.tags or {} |
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 we maybe lift this to the init already? So that self.tags
is always a dict?
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. I have a concern about this. The current self.tags
looks to be a public attribute (it has no prefix '_'), so I worried that the user could set None
to it after the initialization.
Note that the document does not say the tags
are public, so I'm not sure it is intentional:
https://pytorch-lightning.readthedocs.io/en/latest/api/pytorch_lightning.loggers.mlflow.html#mlflow-logger
Another minor reason why I put this here is to minimize the side effect. If the run_name
is not set explicitly, the self.tags
still be 'None' after this PR. this is the same behavior as the current version.
I could not judge which is better, so any suggestions and comments are welcome!
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.
LGTM !
What does this PR do?
This PR adds a
run_name
argument to the MLFlowLogger constructor.As is shown in #7571, the
run_name
is used to identify the specific execution (run) in mlflow.By default, the
run_name
is the same value as therun_id
that is a UUID.So, mlflow allows the user to set more informative
run_name
inmlflow.start_run
method argument^[1].The current MLFlowLogger does not support setting the
run_name
explicitly.(As I pointed out in #7571, there is a workaround, but it is hard to notice, I think.)
So, in this PR, the
run_name
argument is added to the MLFlowLogger.To make this PR, I referred to the current implementation of
mlflow.start_run
^[1]I would appreciate it if you could review this PR.
[1] https://www.mlflow.org/docs/latest/python_api/mlflow.html#mlflow.start_run
Fixes #7571
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?
Make sure you had fun coding 🙃
👍