Experiment Tracking with LitLogger

LitLogger is the experiment tracker built into Lightning AI. Instrument your code with metrics, upload media and artifacts, and then visualize these over time inside the Lightning AI platform. LitLogger can be integrated into standalone scripts, or works seamlessly with PyTorch Lightning and Lightning Fabric.

Comparing experiment metrics with charts

Start Here

Use this path if you are new to LitLogger:

  1. Installation
  2. Quickstart
  3. Files, Media, Models
  4. Lightning Tutorial
  5. Complete Workflow

Supported Workflows

LitLogger supports several key workflows:

  • Start or resume an Experiment with litlogger.init.init
  • Log numeric metrics, Model or File artifacts, and media such as Image and Text
  • Integrate seamlessly with PyTorch Lightning or Lightning Fabric using the lightning:lightning.pytorch.loggers.LitLogger API
  • Log inference metrics from LitServe

Quick Example

import litlogger
from litlogger import Text, File, Model, Image

# Create or resume an experiment with an optional name
experiment = litlogger.init(name="quickstart")

# Set experiment-level metadata, media, or artifacts
experiment["model_name"] = "resnet50"
# experiment["model"] = Model(<filepath or object>)
# experiment["config"] = File(<filepath>)

# Use append to log metrics or media at each step or epoch
global_step = 0
for epoch in range(5):
    for step in range(10):
        experiment["epoch"].append(epoch, step=global_step)
        experiment["train/loss"].append(1.0 / (global_step + 1), step=global_step)
        global_step += 1

    # experiment["validation_image"].append(Image(<filepath or object>), step=global_step)

experiment["summary"] = Text(f"Completed {global_step} steps across {epoch} epochs")

# Manually mark the experiment as complete
experiment.finalize()

Documentation Map

Tutorials provide end-to-end, task-oriented walkthroughs.

Guides explain workflows, migration paths, and logging patterns in more depth.

Examples include every runnable example currently shipped in the repository.

The API reference documents the public classes, functions, and enums.

Start

Tutorials

Guides

Examples

See Examples for the full list of runnable repository examples.

API Reference

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close