MLFlowLogger
- class torchtune.training.metric_logging.MLFlowLogger(experiment_name: Optional[str] = None, tracking_uri: Optional[str] = None, run_id: Optional[str] = None, run_name: Optional[str] = None)[source]
Logger for use w/ MLFlow (https://mlflow.org/).
- Parameters:
experiment_name (Optional[str]) – MLFlow experiment name. If not specified, will default to MLFLOW_EXPERIMENT_NAME environment variable if set, or default.
tracking_uri (Optional[str]) – MLFlow tracking uri. If not specified, will default to MLFLOW_TRACKING_URI environment variable if set, or default.
run_id (Optional[str]) – MLFlow run name. If not specified, will default to mlflow-generated HRID. Unused if run_id is specified or MLFLOW_RUN_ID environment variable is found.
run_name (Optional[str]) – MLFlow run ID. If not specified, will default to MLFLOW_RUN_ID environment variable if set, or a new run will be created.
Example
>>> logger = MLFlowLogger(experiment_name="my_experiment", run_name="run1") >>> logger.log("accuracy", 0.95, step=1) >>> logger.log_dict({"loss": 0.1, "accuracy": 0.95}, step=1) >>> logger.log_config(config) >>> logger.close()
- Raises:
ImportError – If
mlflow
package is not installed.
Note
This logger requires the mlflow package to be installed. You can install it with pip install mlflow.
- close() None [source]
Ends the MLflow run. After calling close, no further logging should be performed.