Skip to content
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

[BugFix] MLFlow logger #2152

Merged
merged 1 commit into from
May 3, 2024
Merged

[BugFix] MLFlow logger #2152

merged 1 commit into from
May 3, 2024

Conversation

GJBoth
Copy link
Contributor

@GJBoth GJBoth commented May 2, 2024

Currently, the MLFlow logger always tries to create a new experiment by calling create_experiment. If the experiment name already exists, this throws an error - so in practice running your script for the second time will crash the run. Additionally, MLFlow considers an experiment as a collection of runs, so we don't want to create a new experiment for each run.

This PR modifies this logic by first checking if an experiment exists, creating one if necessary, and otherwise just retrieves the experiment ID.

Additionally, the MLFlow runs should be closed using mlflow.end_run() when it's not called as a context manager (as is the case for us). Do we want to add a shutdown method to the Logger base class to handle that? I can do that in this PR or in another.

Copy link

pytorch-bot bot commented May 2, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/2152

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures, 2 Unrelated Failures

As of commit 98fb66f with merge base 5b9cb44 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 2, 2024
@vmoens vmoens added the Logging label May 3, 2024
@vmoens
Copy link
Contributor

vmoens commented May 3, 2024

Thanks for this! MLFlow hasn't been used a lot so any bug fix of feature improvement is more than welcome!

Copy link
Contributor

@vmoens vmoens left a comment

Choose a reason for hiding this comment

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

LGTM

@vmoens vmoens merged commit 6f1194b into pytorch:main May 3, 2024
52 of 58 checks passed
@vmoens vmoens changed the title Fix MLFlow logger [BugFix] MLFlow logger May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Logging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants