def create_checkpoint_callback(
    save_last: bool = False,
    save_top_k: int = 0,
    monitor: str = "loss",
    dirpath: Optional[str] = None,
) -> ModelCheckpoint:
    """Initializes the checkpoint callback.

    Args:
        save_last:
            Whether or not to save the checkpoint of the last epoch.
        save_top_k:
            Save the top_k model checkpoints.
        monitor:
            Which quantity to monitor.
        dirpath:
            Where to save the checkpoint.

    Returns:
        ModelCheckpoint: The initialized checkpoint callback.

    """
    return ModelCheckpoint(
        dirpath=os.getcwd() if dirpath is None else dirpath,
        filename="lightly_epoch_{epoch:d}",
        save_last=save_last,
        save_top_k=save_top_k,
        monitor=monitor,
        auto_insert_metric_name=False,
    )
Initializes the checkpoint callback.

    Args:
        save_last:
            Whether or not to save the checkpoint of the last epoch.
        save_top_k:
            Save the top_k model checkpoints.
        monitor:
            Which quantity to monitor.
        dirpath:
            Where to save the checkpoint.

    Returns:
        ModelCheckpoint: The initialized checkpoint callback.

    
lightly/embedding/callbacks.py