Files, Media, Models

Files, Media, Models

This tutorial covers the new file-like API surface:

Static Files

import litlogger
from litlogger import File

experiment = litlogger.init(name="artifacts-demo")
experiment["config"] = File("config.yaml")

File Series

Append file-like values to create a time series:

for step in range(3):
    experiment["reports"].append(File(f"report-{step}.txt"))

Text

Use Text for text content you want rendered to a temporary file and uploaded automatically.

from litlogger import Text

experiment["notes"] = Text("experiment summary")
experiment["captions"].append(Text("checkpoint at step 0"), step=0)

Images

Image accepts a path or common in-memory image data.

from litlogger import Image

experiment["preview"] = Image("preview.png")
experiment["samples"].append(Image("sample-0.png"), step=0)

Models

Use Model for model objects or saved model files.

from litlogger import Model

experiment["checkpoint"] = Model("checkpoint.ckpt", version="latest")
experiment["checkpoints"].append(Model("checkpoint-1.ckpt", version="step-1"))

Unlike files, images, and text entries, logged models are registered in the Weights tab of Lightning AI rather than the experiment’s Experiments tab. For background, see the Lightning model registry docs. Within the current process, uploaded Model values are rebound with download or load behavior. Resumed experiment recovery for models still needs dedicated backend support.

Finalize

experiment.finalize()

Runnable Example

See Examples for the full examples/file_media_model_usage.py walkthrough.

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close