-
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
Get experiment_id from MLFlow only once instead of each training loop. #3394
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3394 +/- ##
========================================
- Coverage 85% 83% -2%
========================================
Files 98 102 +4
Lines 8072 9159 +1087
========================================
+ Hits 6897 7611 +714
- Misses 1175 1548 +373 |
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.
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
@patrickorlando This test fails on master, could you add it to the file tests/loggers/test_mlflow.py ? def test_mlflow_experiment_created_once(tmpdir):
logger = MLFlowLogger('test', save_dir=tmpdir)
get_experiment_name = logger.experiment.get_experiment_by_name
with mock.patch.object(MlflowClient, 'get_experiment_by_name', wraps=get_experiment_name) as mocked:
_ = logger.experiment
_ = logger.experiment
_ = logger.experiment
assert mocked.call_count == 1 Thanks |
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.
requesting a test to make the bugfix complete, see my comment above
@awaelchli I've added the test case, but I had to change
to
It had already been called in the first case before it was mocked and the test was failing. I've checked that this change still fails on master (
|
Hello @patrickorlando! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-09-09 09:13:44 UTC |
oh I see, because I had it added to the top of the file. But this way is better 👍 |
This pull request is now in conflict... :( |
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
What does this PR do?
When using the MLFLow logger, the MLFLow client retrieves the experiment id from the MLFlowClient each time
logger.experiment
is called/accessed. This causes overhead during training and validation loops which is dramatic if the server is remote.This PR checks whether the experiment_id is already defined (meaning it has already been retrieved) and does not make the call to MLFlow if so.
Fixes #3393
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃