Use `args.name` as `run_name` for MLFlow system. (#3567)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
single_channel
andrewerf 1 year ago committed by GitHub
parent 3821d4a72c
commit e33d6522ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,6 +27,7 @@ def on_pretrain_routine_end(trainer):
mlflow.set_tracking_uri(mlflow_location) mlflow.set_tracking_uri(mlflow_location)
experiment_name = os.environ.get('MLFLOW_EXPERIMENT') or trainer.args.project or '/Shared/YOLOv8' 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) experiment = mlflow.get_experiment_by_name(experiment_name)
if experiment is None: if experiment is None:
mlflow.create_experiment(experiment_name) mlflow.create_experiment(experiment_name)
@ -36,7 +37,7 @@ def on_pretrain_routine_end(trainer):
try: try:
run, active_run = mlflow, mlflow.active_run() run, active_run = mlflow, mlflow.active_run()
if not 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 run_id = active_run.info.run_id
LOGGER.info(f'{prefix}Using run_id({run_id}) at {mlflow_location}') LOGGER.info(f'{prefix}Using run_id({run_id}) at {mlflow_location}')
run.log_params(vars(trainer.model.args)) run.log_params(vars(trainer.model.args))

Loading…
Cancel
Save