From 82fb0835df96897222be207412178086ed86cb68 Mon Sep 17 00:00:00 2001 From: Rustem Galiullin Date: Wed, 10 May 2023 13:07:18 +0400 Subject: [PATCH] use existing mlflow experiment if exists --- src/accelerate/tracking.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/accelerate/tracking.py b/src/accelerate/tracking.py index 962baf681b9..cd54ee67ed9 100644 --- a/src/accelerate/tracking.py +++ b/src/accelerate/tracking.py @@ -579,11 +579,17 @@ def __init__( nested_run = os.getenv("MLFLOW_NESTED_RUN", nested_run) - experiment_id = mlflow.create_experiment( - name=experiment_name, - artifact_location=logging_dir, - tags=tags, - ) + exps = mlflow.search_experiments(filter_string=f"name = '{experiment_name}'") + if len(exps) > 0: + if len(exps) > 1: + logger.warning("Multiple experiments with the same name found. Using first one.") + experiment_id = exps[0].experiment_id + else: + experiment_id = mlflow.create_experiment( + name=experiment_name, + artifact_location=logging_dir, + tags=tags, + ) self.active_run = mlflow.start_run( run_id=run_id,