-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Make MLFlow version detection more robust and handles mlflow-skinny #29957
Make MLFlow version detection more robust and handles mlflow-skinny #29957
Conversation
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.
Hey This seems to have been fixed by #29918
fc02966
to
0eeae87
Compare
Thanks @ArthurZucker for reviewing. The fix #29917 indeed will address the mlflow-skinny problem. In my PR, I made the code more robust in case MLFlow version detection failed and the job will not crash and instead default to not use async metric logging. |
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.
Hey! Not sure we want a fallback here, the MLflowCallback should raise an error if mlflow
is not available no?
if not is_mlflow_available():
raise RuntimeError("MLflowCallback requires mlflow to be installed. Run `pip install mlflow`.")
import mlflow
will raise an error. We can update the is_mlflow_available
to take into account mlflow-skinny
and that will allow us to do something like if importlib.metadata.version(self._ml_flow)
instead of using the get_mlflow_version
!
0eeae87
to
a126d3c
Compare
@ArthurZucker The |
c5b0a6a
to
fd023ef
Compare
Thanks! Again, I think we should also fix the I am fine with the current changes, but we should go for minimal! |
Thanks for reviewing again. The current
The issue addressing here is the version check is the "Async logging" requires |
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.
Ok, I am still a bit confused because at this point you already have access to self._mlflow
, which is as you said either mlflow
or mlflow-skinny
's mlflow.
Thus you should only have to do self._mlflow.__version__
.
Again I don't understand how yoyu could not determine the mlflow version it's installed if you can go here. A bad install maybe?
Anyways, we should not have to re-import
# https://github.com/mlflow/mlflow/releases/tag/v2.8.0 | ||
if packaging.version.parse(get_mlflow_version()) >= packaging.version.parse("2.8.0"): | ||
self._async_log = True | ||
self._async_log = is_mlflow_async_log_available() |
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.
self._async_log = is_mlflow_async_log_available() | |
self._async_log = packaging.version.parse(self._mlflow.__version__) >= packaging.version.parse("2.8.0"): |
should be the only thing you have to do
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.
@ArthurZucker Got it. Thanks for the suggestion. It is definitely much simpler and cleaner. I have tested working correctly for both mlfow and mlflow-skinny and updated PR.
fd023ef
to
1fb2ed2
Compare
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.
Much much cleaner thanks
Unrelated failing tests, merging |
…uggingface#29957) * Make MLFlow version detection more robust and handles mlflow-skinny * Make function name more clear and refactor the logic * Further refactor
…29957) * Make MLFlow version detection more robust and handles mlflow-skinny * Make function name more clear and refactor the logic * Further refactor
…29957) * Make MLFlow version detection more robust and handles mlflow-skinny * Make function name more clear and refactor the logic * Further refactor
What does this PR do?
MLFlow can be provided from either "mlflow" or "mlflow-skinny" package. See https://pypi.org/project/mlflow/.
This PR updated the version check of mlflow to include "mlflow-skinny" package.
Also make the version check not crashing and fallback to synchronous metrics logging if version is not detected.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@ArthurZucker @pacman100 @cchen-dialpad