Shortcuts

DiskLogger

class torchtune.utils.metric_logging.DiskLogger(log_dir: str, filename: Optional[str] = None, **kwargs)[source]

Logger to disk.

Parameters:
  • log_dir (str) – directory to store logs

  • filename (Optional[str]) – optional filename to write logs to. Default: None, in which case log_{unixtimestamp}.txt will be used.

  • **kwargs – additional arguments

Warning

This logger is not thread-safe.

Note

This logger creates a new file based on the current time.

close() None[source]

Close log resource, flushing if necessary. Logs should not be written after close is called.

log(name: str, data: Union[Tensor, ndarray, int, float], step: int) None[source]

Log scalar data.

Parameters:
  • name (str) – tag name used to group scalars

  • data (Scalar) – scalar data to log

  • step (int) – step value to record

log_dict(payload: Mapping[str, Union[Tensor, ndarray, int, float]], step: int) None[source]

Log multiple scalar values.

Parameters:
  • payload (Mapping[str, Scalar]) – dictionary of tag name and scalar value

  • step (int) – step value to record

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources