LightningIRWandbLogger

class lightning_ir.main.LightningIRWandbLogger(name: str | None = None, save_dir: str | Path = '.', version: str | None = None, offline: bool = False, dir: str | Path | None = None, id: str | None = None, anonymous: bool | None = None, project: str | None = None, log_model: Literal['all'] | bool = False, experiment: Run | RunDisabled | None = None, prefix: str = '', checkpoint_name: str | None = None, **kwargs: Any)[source]

Bases: WandbLogger

__init__(name: str | None = None, save_dir: str | Path = '.', version: str | None = None, offline: bool = False, dir: str | Path | None = None, id: str | None = None, anonymous: bool | None = None, project: str | None = None, log_model: Literal['all'] | bool = False, experiment: Run | RunDisabled | None = None, prefix: str = '', checkpoint_name: str | None = None, **kwargs: Any) None

Methods

Attributes

save_dir

Gets the save directory.

after_save_checkpoint(checkpoint_callback: ModelCheckpoint) None

Called after model checkpoint callback saves a new checkpoint.

Parameters:

checkpoint_callback – the model checkpoint callback instance

static download_artifact(artifact: str, save_dir: str | Path | None = None, artifact_type: str | None = None, use_artifact: bool | None = True) str

Downloads an artifact from the wandb server.

Parameters:
  • artifact – The path of the artifact to download.

  • save_dir – The directory to save the artifact to.

  • artifact_type – The type of artifact to download.

  • use_artifact – Whether to add an edge between the artifact graph.

Returns:

The path to the downloaded artifact.

property experiment: Run | RunDisabled

Actual wandb object. To use wandb features in your LightningModule do the following.

Example:

.. code-block:: python

self.logger.experiment.some_wandb_function()

finalize(status: str) None

Do any processing that is necessary to finalize an experiment.

Parameters:

status – Status that the experiment finished with (e.g. success, failed, aborted)

property group_separator: str

Return the default separator used by the logger to group the data into subfolders.

log_audio(key: str, audios: list[Any], step: int | None = None, **kwargs: Any) None

Log audios (numpy arrays, or file paths).

Parameters:
  • key – The key to be used for logging the audio files

  • audios – The list of audio file paths, or numpy arrays to be logged

  • step – The step number to be used for logging the audio files

  • **kwargs – Optional kwargs are lists passed to each Wandb.Audio instance (ex: caption, sample_rate).

Optional kwargs are lists passed to each audio (ex: caption, sample_rate).

property log_dir: str | None

Return directory the current version of the experiment gets saved, or None if the logger does not save data locally.

log_graph(model: Module, input_array: Tensor | None = None) None

Record model graph.

Parameters:
  • model – the model with an implementation of forward.

  • input_array – input passes to model.forward

log_hyperparams(params: dict[str, Any] | Namespace) None

Record hyperparameters.

Parameters:
  • paramsNamespace or Dict containing the hyperparameters

  • args – Optional positional arguments, depends on the specific logger being used

  • kwargs – Optional keyword arguments, depends on the specific logger being used

log_image(key: str, images: list[Any], step: int | None = None, **kwargs: Any) None

Log images (tensors, numpy arrays, PIL Images or file paths).

Optional kwargs are lists passed to each image (ex: caption, masks, boxes).

log_metrics(metrics: Mapping[str, float], step: int | None = None) None

Records metrics. This method logs metrics as soon as it received them.

Parameters:
  • metrics – Dictionary with metric names as keys and measured quantities as values

  • step – Step number at which the metrics should be recorded

log_table(key: str, columns: list[str] | None = None, data: list[list[Any]] | None = None, dataframe: Any = None, step: int | None = None) None

Log a Table containing any object type (text, image, audio, video, molecule, html, etc).

Can be defined either with columns and data or with dataframe.

log_text(key: str, columns: list[str] | None = None, data: list[list[str]] | None = None, dataframe: Any = None, step: int | None = None) None

Log text as a Table.

Can be defined either with columns and data or with dataframe.

log_video(key: str, videos: list[Any], step: int | None = None, **kwargs: Any) None

Log videos (numpy arrays, or file paths).

Parameters:
  • key – The key to be used for logging the video files

  • videos – The list of video file paths, or numpy arrays to be logged

  • step – The step number to be used for logging the video files

  • **kwargs – Optional kwargs are lists passed to each Wandb.Video instance (ex: caption, fps, format).

Optional kwargs are lists passed to each video (ex: caption, fps, format).

property name: str | None

The project name of this experiment.

Returns:

The name of the project the current experiment belongs to. This name is not the same as wandb.Run’s name. To access wandb’s internal experiment name, use logger.experiment.name instead.

property root_dir: str | None

Return the root directory where all versions of an experiment get saved, or None if the logger does not save data locally.

save() None

Save log data.

property save_dir: str | None

Gets the save directory.

Returns:

The path to the save directory.

use_artifact(artifact: str, artifact_type: str | None = None) Artifact

Logs to the wandb dashboard that the mentioned artifact is used by the run.

Parameters:
  • artifact – The path of the artifact.

  • artifact_type – The type of artifact being used.

Returns:

wandb Artifact object for the artifact.

property version: str | None

Gets the id of the experiment.

Returns:

The id of the experiment if the experiment exists else the id given to the constructor.