Reference for ultralytics/utils/callbacks/mlflow.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/utils/callbacks/mlflow.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.utils.callbacks.mlflow.sanitize_dict
sanitize_dict(x: dict) -> dict
Sanitize dictionary keys by removing parentheses and converting values to floats.
Source code in ultralytics/utils/callbacks/mlflow.py
42 43 44 |
|
ultralytics.utils.callbacks.mlflow.on_pretrain_routine_end
on_pretrain_routine_end(trainer)
Log training parameters to MLflow at the end of the pretraining routine.
This function sets up MLflow logging based on environment variables and trainer arguments. It sets the tracking URI, experiment name, and run name, then starts the MLflow run if not already active. It finally logs the parameters from the trainer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer
|
BaseTrainer
|
The training object with arguments and parameters to log. |
required |
Global
mlflow: The imported mlflow module to use for logging.
Environment Variables
MLFLOW_TRACKING_URI: The URI for MLflow tracking. If not set, defaults to 'runs/mlflow'. MLFLOW_EXPERIMENT_NAME: The name of the MLflow experiment. If not set, defaults to trainer.args.project. MLFLOW_RUN: The name of the MLflow run. If not set, defaults to trainer.args.name. MLFLOW_KEEP_RUN_ACTIVE: Boolean indicating whether to keep the MLflow run active after the end of training.
Source code in ultralytics/utils/callbacks/mlflow.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
ultralytics.utils.callbacks.mlflow.on_train_epoch_end
on_train_epoch_end(trainer)
Log training metrics at the end of each train epoch to MLflow.
Source code in ultralytics/utils/callbacks/mlflow.py
91 92 93 94 95 96 97 98 99 100 |
|
ultralytics.utils.callbacks.mlflow.on_fit_epoch_end
on_fit_epoch_end(trainer)
Log training metrics at the end of each fit epoch to MLflow.
Source code in ultralytics/utils/callbacks/mlflow.py
103 104 105 106 |
|
ultralytics.utils.callbacks.mlflow.on_train_end
on_train_end(trainer)
Log model artifacts at the end of the training.
Source code in ultralytics/utils/callbacks/mlflow.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|