ml.loggers.wandb

Defines a Weights & Biases logging inferface.

This interface is used to log metrics and artifacts to Weights & Biases.

class ml.loggers.wandb.WandbLoggerConfig(name: str = '???', write_every_n_seconds: float | None = None, write_train_every_n_seconds: float | None = None, write_val_every_n_seconds: float | None = None, flush_seconds: float = 10.0)[source]

Bases: BaseLoggerConfig

flush_seconds: float = 10.0
class ml.loggers.wandb.WandbLogger(config: WandbLoggerConfig)[source]

Bases: BaseLogger[WandbLoggerConfig]

initialize(log_directory: Path) None[source]
log_scalar(key: str, value: Callable[[], int | float | Tensor], state: State, namespace: str) None[source]

Logs a scalar value.

Parameters:
  • key – The key to log

  • value – The value to log

  • state – The current log state

  • namespace – The namespace to be logged

log_string(key: str, value: Callable[[], str], state: State, namespace: str) None[source]

Logs a string value.

Parameters:
  • key – The key to log

  • value – The value to log

  • state – The current log state

  • namespace – The namespace to be logged

log_image(key: str, value: Callable[[], Tensor], state: State, namespace: str) None[source]

Logs a normalized image, with shape (C, H, W).

Parameters:
  • key – The key to log

  • value – The value to log

  • state – The current log state

  • namespace – The namespace to be logged

log_audio(key: str, value: Callable[[], tuple[torch.Tensor, int]], state: State, namespace: str) None[source]

Logs a normalized audio, with shape (T,).

Parameters:
  • key – The key to log

  • value – The value to log

  • state – The current log state

  • namespace – The namespace to be logged

log_video(key: str, value: Callable[[], Tensor], state: State, namespace: str) None[source]

Logs a normalized video, with shape (T, C, H, W).

Parameters:
  • key – The key to log

  • value – The value to log

  • state – The current log state

  • namespace – The namespace to be logged

write(state: State) None[source]

Writes the logs.

Parameters:

state – The current log state

clear(state: State) None[source]
default_write_every_n_seconds(state: State) float[source]

Returns the default write interval in seconds.

Parameters:

state – The state to get the default write interval for

Returns:

The default write interval, in seconds