Skip to content

Commit

Permalink
Use args.name as run_name for MLFlow system. (ultralytics#3567)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <[email protected]>
  • Loading branch information
andrewerf and glenn-jocher authored Jul 6, 2023
1 parent 3821d4a commit e33d652
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ultralytics/yolo/utils/callbacks/mlflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit e33d652

Please sign in to comment.