From e33d6522abe60f90df8e3146a5c5d7371e3c0a85 Mon Sep 17 00:00:00 2001 From: andrewerf Date: Thu, 6 Jul 2023 17:19:56 +0300 Subject: [PATCH] Use `args.name` as `run_name` for MLFlow system. (#3567) Co-authored-by: Glenn Jocher --- ultralytics/yolo/utils/callbacks/mlflow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ultralytics/yolo/utils/callbacks/mlflow.py b/ultralytics/yolo/utils/callbacks/mlflow.py index f97d472..e61ca3d 100644 --- a/ultralytics/yolo/utils/callbacks/mlflow.py +++ b/ultralytics/yolo/utils/callbacks/mlflow.py @@ -27,6 +27,7 @@ def on_pretrain_routine_end(trainer): mlflow.set_tracking_uri(mlflow_location) experiment_name = os.environ.get('MLFLOW_EXPERIMENT') or trainer.args.project or '/Shared/YOLOv8' + run_name = os.environ.get('MLFLOW_RUN') or trainer.args.name experiment = mlflow.get_experiment_by_name(experiment_name) if experiment is None: mlflow.create_experiment(experiment_name) @@ -36,7 +37,7 @@ def on_pretrain_routine_end(trainer): try: run, active_run = mlflow, mlflow.active_run() if not active_run: - active_run = mlflow.start_run(experiment_id=experiment.experiment_id) + active_run = mlflow.start_run(experiment_id=experiment.experiment_id, run_name=run_name) run_id = active_run.info.run_id LOGGER.info(f'{prefix}Using run_id({run_id}) at {mlflow_location}') run.log_params(vars(trainer.model.args))