Experiments/Integrations

PyTorch Lightning

Integrating with PyTorch Lightning

Open In Colab

mlop provides super performant integration with PyTorch Lightning, including dedicated support for checkpointing, logging artifacts, model details, and more.

Migrating from Weights & Biases

See the Migrating from Weights & Biases guide for a quickstart.

Logging Lightning Models

To use mlop as a PyTorch or Fabric Logger for Lightning, simply import the logger class dedicated for Lightning and use it in the Trainer or Fabric initialization.

from mlop.compat.lightning import MLOPLogger
 
logger = MLOPLogger(
    op=None,
    project=None,
    name=None,
    **kwargs,
)
trainer = Trainer(logger=logger)
fabric = L.Fabric(loggers=[logger])
ParameterTypeDescription
opmlop.op.OpThe initialized mlop run to log to.
projectOptional[str]The name of the project (if uninitialized).
nameOptional[str]The name of the run (if uninitialized).
**kwargsAnyAdditional keyword arguments accepted by the mlop.init constructor.

Source

See the Python code for more details.

Using MLOPLogger

The MLOPLogger inherits from the standard lightning.pytorch.loggers.Logger class, and strictly conforms to its standard API interface.

MethodDescriptionExample
log_metricsLog metrics to mlop.logger.log_metrics(data: Dict[str, float])
log_hyperparamsLog hyperparameters to mlop.logger.log_hyperparams(params: Dict[str, Any])
log_fileLog a file to mlop.logger.log_file(key: str, files: List[mlop.File], **kwargs)
log_imageLog an image to mlop.logger.log_image(key: str, images: List[mlop.Image], **kwargs)
log_audioLog an audio file to mlop.logger.log_audio(key: str, audios: List[mlop.Audio], **kwargs)
log_videoLog a video to mlop.logger.log_video(key: str, videos: List[mlop.Video], **kwargs)
log_checkpointLog a checkpoint to mlop.logger.log_checkpoint(key: str, checkpoint: "ModelCheckpoint", **kwargs)
log_graphLog a model graph to mlop.logger.log_graph(model: "torch.nn.Module", **kwargs)
watchWatch a model.logger.watch(model: "torch.nn.Module", **kwargs)

On this page