|
|
|
@ -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))
|
|
|
|
|