neural_lam.custom_loggers#
Custom logging utilities (e.g., MLFlow wrappers) used in Neural-LAM.
Classes#
Custom MLFlow logger that adds the log_image() functionality not |
Module Contents#
- class neural_lam.custom_loggers.CustomMLFlowLogger(experiment_name: str, tracking_uri: str, run_name: str, save_dir: str)[source]#
Bases:
pytorch_lightning.loggers.MLFlowLoggerCustom MLFlow logger that adds the log_image() functionality not present in the default implementation from pytorch-lightning as of version 2.0.3 at least.
Initialize the logger, ensure
save_direxists, and start the MLflow run.- Parameters:
Notes
Starts the MLflow run with
log_system_metrics=Trueand also recordsrun_idas an MLflow param.- log_image(key: str, images: list[matplotlib.pyplot.Figure], step: int | None = None) None[source]#
Log one or more matplotlib figures as images to MLFlow.
When
imagescontains more than one figure, each is logged under a key suffixed with its position in the list (key_0,key_1, …). A single-figure list is logged under the bare key.- Parameters:
- Raises:
botocore.exceptions.NoCredentialsError – If AWS credentials for the MLflow artifact store are missing; re-raised for the caller to handle.