Standalone Usage

Use LitLogger in any Python process without Lightning. For new code, the recommended standalone workflow is the dict-style Experiment API returned by litlogger.init().

Comparing experiment metrics in a table

import litlogger
from litlogger import File

experiment = litlogger.init(name="my-experiment")

experiment["model"] = "resnet50"
experiment["lr"] = "0.001"

for step in range(100):
    experiment["train/loss"].append(1.0 / (step + 1), step=step)
    experiment["train/accuracy"].append(step / 100.0, step=step)

experiment["config"] = File("config.yaml")
experiment.finalize()

The new standalone API covers:

Metric Logging

experiment["loss"].append(0.5, step=0)
experiment["loss"].extend([0.4, 0.3, 0.2], start_step=1)

Metadata

Metadata can be provided at initialization time or added later:

experiment = litlogger.init(
    name="training-run",
    metadata={"dataset": "imagenet"},
)

experiment["optimizer"] = "adamw"

Files, Media, and Models

from litlogger import File, Image, Model, Text

experiment["config"] = File("config.yaml")
experiment["preview"] = Image("sample.png")
experiment["notes"] = Text("training summary")
experiment["checkpoint"] = Model("checkpoint.ckpt")

Resume by Name

Initializing with the same name reconnects to the same experiment.

experiment = litlogger.init(name="my-experiment")
experiment["train/loss"].append(0.2, step=100)
experiment.finalize()

Runtime Views

Use metadata, metrics, artifacts, and url to inspect the current run state.

print(experiment.metadata)
print(experiment.metrics)
print(experiment.artifacts)
print(experiment.url)

Legacy Module-Level API

The older module-level API is still available for compatibility through log_metrics(), log_file(), log_metadata(), and finalize():

import litlogger

litlogger.init(name="legacy-script")
litlogger.log_metrics({"loss": 0.5}, step=0)
litlogger.log_file("config.yaml")
litlogger.log_metadata({"model": "resnet50"})
litlogger.finalize()

This API is useful for existing scripts, but the dict-style API is the primary user-facing workflow.

Operational Options

Common standalone options:

  • teamspace=... to select a teamspace explicitly
  • save_logs=True to capture terminal output as console_output.txt
  • light_color=... and dark_color=... to override chart colors
  • store_step=False or store_created_at=True to control tracker data

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close