Skip to content

Commit

Permalink
fix: get mlflow version from mlflow-skinny (#29918)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Jipa <[email protected]>
  • Loading branch information
Alexander Jipa and azzhipa authored Mar 30, 2024
1 parent 156d30d commit e644b60
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/transformers/integrations/integration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ def is_mlflow_available():
return importlib.util.find_spec("mlflow") is not None


def get_mlflow_version():
try:
return importlib.metadata.version("mlflow")
except importlib.metadata.PackageNotFoundError:
return importlib.metadata.version("mlflow-skinny")


def is_dagshub_available():
return None not in [importlib.util.find_spec("dagshub"), importlib.util.find_spec("mlflow")]

Expand Down Expand Up @@ -1002,7 +1009,7 @@ def setup(self, args, state, model):
# "synchronous" flag is only available with mlflow version >= 2.8.0
# https://github.com/mlflow/mlflow/pull/9705
# https://github.com/mlflow/mlflow/releases/tag/v2.8.0
if packaging.version.parse(importlib.metadata.version("mlflow")) >= packaging.version.parse("2.8.0"):
if packaging.version.parse(get_mlflow_version()) >= packaging.version.parse("2.8.0"):
self._async_log = True
logger.debug(
f"MLflow experiment_name={self._experiment_name}, run_name={args.run_name}, nested={self._nested_run},"
Expand Down

0 comments on commit e644b60

Please sign in to comment.