API Reference
This reference documents the public LitLogger surface:
- initialization functions
- module-level compatibility helpers
- the
Experimentclass - file, media, and model wrappers
- series and public enums
LightningLogger(deprecated compatibility alias)
Initialization
init
litlogger.init.init(name=None, root_dir=None, teamspace=None, metadata=None, store_step=True, store_created_at=False, save_logs=False, print_url=True, verbose=True, **kwargs)
Initialize a litlogger experiment for standalone usage.
Example:
import litlogger
litlogger.init(name="my-experiment")
for i in range(100):
litlogger.log({"loss": 1.0 / (i + 1), "accuracy": i / 100.0}, step=i)
litlogger.finalize()Parameters:
- name (str | None) – Name of your experiment (defaults to a generated name).
- root_dir (str | None) – Folder where logs and metadata are stored (default: ./lightning_logs).
- teamspace (str | Teamspace | None) – Teamspace where charts and artifacts will appear.
- metadata (dict[str, str] | None) – Extra metadata to associate with the experiment as tags.
- store_step (bool | None) – Whether to store the step field with each logged value.
- store_created_at (bool | None) – Whether to store a creation timestamp with each value.
- save_logs (bool) – If True, capture and upload terminal logs.
- print_url (bool) – Whether to print the experiment URL and initialization info.
- verbose (bool) – If True, print styled console output. Defaults to True.
- **kwargs (Any) – Additional keyword arguments. Will be forwarded to the Experiment constructor.
- name (str | None)
- root_dir (str | None)
- teamspace (str | Teamspace | None)
- metadata (dict[str, str] | None)
- store_step (bool | None)
- store_created_at (bool | None)
- save_logs (bool)
- print_url (bool)
- verbose (bool)
- kwargs (Any)
Returns: The initialized experiment instance.
Return type: Experiment
finish
litlogger.init.finish(status=None)
Finalize the current experiment.
Deprecated: Use experiment.finalize() instead.
Parameters:
Return type: None
get_metadata
litlogger.init.get_metadata()
Get the metadata associated with the current experiment.
Deprecated: Use experiment.metadata instead.
Returns: The metadata dictionary with key-value pairs from the metrics stream.
Return type: dict[str, str]
Raises:
- RuntimeError – If litlogger.init() has not been called.
Module-Level Helpers
These helpers are available on the top-level litlogger module after initialization. They exist primarily for standalone compatibility workflows.
log
litlogger.log(self, metrics=None, step=None, **kwargs)
Log metrics to the experiment with background uploading.
Deprecated: Use experiment["key"].append(value, step=step) instead.
Metrics are buffered locally and uploaded to the cloud in batches to optimize performance. The batch is sent when either 1 second has passed or 1000 values have been logged.
Parameters:
- metrics (dict[str, float] | None) – Dictionary mapping metric names to numeric values. Example: {“loss”: 0.5, “accuracy”: 0.95}.
- step (int | None) – Optional step number for this data point (e.g., training step, epoch). If None and store_step=True, no step is recorded.
- kwargs (float) – Additional metric values. Can be used to provide metrics more natural. Example: loss=0.5, accuracy: 0.95.
- metrics (dict[str, float] | None)
- step (int | None)
- kwargs (Any)
Raises:
- RuntimeError – If the background thread encountered an error.
Return type: None
log_metrics
litlogger.log_metrics(self, metrics=None, step=None, **kwargs)
Log metrics to the experiment with background uploading.
Deprecated: Use experiment["key"].append(value, step=step) instead.
Metrics are buffered locally and uploaded to the cloud in batches to optimize performance. The batch is sent when either 1 second has passed or 1000 values have been logged.
Parameters:
- metrics (dict[str, float] | None) – Dictionary mapping metric names to numeric values. Example: {“loss”: 0.5, “accuracy”: 0.95}.
- step (int | None) – Optional step number for this data point (e.g., training step, epoch). If None and store_step=True, no step is recorded.
- kwargs (float) – Additional metric values. Can be used to provide metrics more natural. Example: loss=0.5, accuracy: 0.95.
- metrics (dict[str, float] | None)
- step (int | None)
- kwargs (Any)
Raises:
- RuntimeError – If the background thread encountered an error.
Return type: None
log_metadata
litlogger.log_metadata(self, metadata=None, **kwargs)
Add or update metadata tags on the experiment.
Deprecated: Use experiment["key"] = "value" instead.
Merges the provided key-value pairs into the experiment’s existing metadata and pushes the update to the cloud immediately.
Parameters:
- metadata (dict[str, str] | None) – Dictionary of metadata key-value pairs to add or update. Example: {“optimizer”: “adam”, “lr”: “0.001”}.
- **kwargs (str) – Additional metadata as keyword arguments. Example: optimizer=”adam”, lr=”0.001”.
- metadata (dict[str, str] | None)
- kwargs (Any)
Return type: None
log_file
litlogger.log_file(self, path, remote_path=None, verbose=True)
Upload a file artifact to the cloud for this experiment.
Deprecated: Use experiment["key"] = File("path") or experiment["key"].append(File("path")) instead.
The file is uploaded to cloud storage and registered with the experiment, making it visible in the artifacts view and accessible via get_file().
Parameters:
- path (str) – Path to the local file to upload. Can be absolute or relative.
- remote_path (str | None) – Path relative to experiment root for storage and display. If None, uses the path relative to cwd if under cwd, otherwise basename. Example: remote_path=”images/0.png” will store and display as “images/0.png”.
- verbose (bool) – Whether to print a confirmation message after upload. Defaults to True.
- path (str)
- remote_path (str | None)
- verbose (bool)
Return type: None
get_file
litlogger.get_file(self, path, remote_path=None, verbose=True)
Download a file artifact from the cloud for this experiment.
Deprecated: Use experiment["key"] to access files instead.
The file is downloaded from cloud storage (previously uploaded via log_file) and saved to the specified local path.
Parameters:
- path (str) – Path where the file should be saved locally. Parent directories are created if needed.
- remote_path (str | None) – Path relative to experiment root where the file is stored. If None, uses the path relative to cwd if under cwd, otherwise basename. Must match the remote_path used during log_file() for correct resolution.
- verbose (bool) – Whether to print a confirmation message after download. Defaults to True.
- path (str)
- remote_path (str | None)
- verbose (bool)
Returns: The local path where the file was saved (same as the input path).
Return type: str
log_model
litlogger.log_model(self, model, staging_dir=None, verbose=False, version=None, metadata=None)
Save and upload a model object to cloud storage using litmodels.
Deprecated: Use experiment["key"] = File("path") instead.
This saves a live model object (e.g., PyTorch module, LightningModule) to disk using framework-specific serialization, then uploads it to the litmodels registry.
For uploading pre-saved model files, use log_model_artifact() instead.
Parameters:
- model (Any) – The model object to save and upload (e.g., torch.nn.Module, LightningModule).
- staging_dir (str | None) – Optional local directory for staging the model before upload. If None, uses a temp directory.
- verbose (bool) – Whether to show progress bar during upload. Defaults to False.
- version (str | None) – Optional version string for the model.
- metadata (dict[str, str] | None) – Optional metadata dictionary to store with the model (e.g., hyperparameters, metrics).
- model (Any)
- staging_dir (str | None)
- verbose (bool)
- version (str | None)
- metadata (dict[str, str] | None)
Returns: Information about the uploaded model (details from litmodels).
Return type: str
get_model
litlogger.get_model(self, staging_dir=None, verbose=False, version=None)
Get a model object using litmodels load_model.
Deprecated: Use experiment["key"] to access models instead.
Parameters:
- staging_dir (str | None) – Optional directory where the model will be downloaded.
- verbose (bool) – Whether to show progress bar.
- version (str | None) – Optional version string for the model.
- staging_dir (str | None)
- verbose (bool)
- version (str | None)
Return type: Any
Returns: The loaded model object.
log_model_artifact
litlogger.log_model_artifact(self, path, verbose=False, version=None)
Upload a model file or directory to cloud storage using litmodels.
Deprecated: Use experiment["key"] = File("path") instead.
This uploads raw model files (e.g., weights.pt, checkpoint.ckpt) or entire directories to the litmodels registry. Use this when you have pre-saved model files.
For saving model objects directly, use log_model() instead.
Parameters:
- path (str) – Path to the local model file or directory to upload.
- verbose (bool) – Whether to show progress bar during upload. Defaults to False.
- version (str | None) – Optional version string for the model.
- path (str)
- verbose (bool)
- version (str | None)
Return type: None
get_model_artifact
litlogger.get_model_artifact(self, path, verbose=False, version=None)
Download a model artifact file or directory from cloud storage using litmodels.
Deprecated: Use experiment["key"] to access model artifacts instead.
This downloads raw model files or directories that were previously uploaded via log_model_artifact(). The files are saved to the specified local path.
Parameters:
- path (str) – Path where the model should be saved locally. Directories are created if needed.
- verbose (bool) – Whether to show progress bar during download. Defaults to False.
- version (str | None) – Optional version string for the model.
- path (str)
- verbose (bool)
- version (str | None)
Returns: The local path where the model was saved (same as the input path).
Return type: str
finalize
litlogger.finalize(self, status=None, print_summary=True)
Finalize the experiment and upload all remaining metrics.
This method waits for the background thread to finish uploading all queued metrics, and uploads terminal logs if save_logs=True. It’s automatically called on exit via an atexit handler, but can also be called manually.
This method is idempotent and can be called multiple times safely.
Parameters:
- status (str | None) – Optional status string for the experiment (currently unused, reserved for future use).
- print_summary (bool) – Whether to print the run completion summary. Defaults to True.
- status (str | None)
- print_summary (bool)
Return type: None
Experiment
class Experiment
class litlogger.experiment.Experiment(name, log_dir='lightning_logs', save_logs=False, teamspace=None, light_color=None, dark_color=None, metadata=None, store_step=True, store_created_at=False, max_batch_size=1000, rate_limiting_interval=1, verbose=True)
Bases: LegacyExperiment
Core experiment with dict-like API for logging data.
Supports pythonic dict-like access patterns:
experiment[“key”].append(value) # time series (metrics or files) experiment[“key”].extend(values) # batch time series experiment[“key”] = “value” # static metadata experiment[“key”] = File(“path”) # static file artifact experiment[“key”] # fetch data
Also inherits the legacy method-based API used for backwards compatibility (log_metrics, log_file, log_model, etc.).
Keys must be unique across metadata, artifacts, and metrics.
Initialize an experiment for logging to the https://lightning.ai platform.
Parameters:
- name (str) – A human-friendly name for your experiment.
- log_dir (str) – Local directory where temporary logs/artifacts are stored. Defaults to “lightning_logs”.
- save_logs (bool) – If True, capture and upload terminal output as a file artifact. Defaults to False.
- teamspace (str | Teamspace | None) – Teamspace in which to create and display the charts. If None, uses your default teamspace.
- light_color (str | None) – Hex color of the curve in light mode (overrides the random default). Example: “#FF5733”.
- dark_color (str | None) – Hex color of the curve in dark mode (overrides the random default). Example: “#3498DB”.
- metadata (dict[str, str] | None) – Key-value parameters associated with the experiment (displayed as tags in the UI).
- store_step (bool | None) – Whether to store the provided step for each data point. Defaults to True.
- store_created_at (bool | None) – Whether to store a creation timestamp for each data point. Defaults to False.
- max_batch_size (int) – Number of metric values to batch before uploading. Defaults to 1000.
- rate_limiting_interval (int) – Minimum seconds between uploads. Defaults to 1.
- verbose (bool) – If True, print styled console output. Defaults to True.
- name (str)
- log_dir (str)
- save_logs (bool)
- teamspace (str | Teamspace | None)
- light_color (str | None)
- dark_color (str | None)
- metadata (dict[str, str] | None)
- store_step (bool | None)
- store_created_at (bool | None)
- max_batch_size (int)
- rate_limiting_interval (int)
- verbose (bool)
finalize
finalize(status=None, print_summary=True)
Finalize the experiment and upload all remaining metrics.
This method waits for the background thread to finish uploading all queued metrics, and uploads terminal logs if save_logs=True. It’s automatically called on exit via an atexit handler, but can also be called manually.
This method is idempotent and can be called multiple times safely.
Parameters:
- status (str | None) – Optional status string for the experiment (currently unused, reserved for future use).
- print_summary (bool) – Whether to print the run completion summary. Defaults to True.
- status (str | None)
- print_summary (bool)
Return type: None
get_file
get_file(path, remote_path=None, verbose=True)
Download a file artifact from the cloud for this experiment.
Deprecated: Use experiment["key"] to access files instead.
The file is downloaded from cloud storage (previously uploaded via log_file) and saved to the specified local path.
Parameters:
- path (str) – Path where the file should be saved locally. Parent directories are created if needed.
- remote_path (str | None) – Path relative to experiment root where the file is stored. If None, uses the path relative to cwd if under cwd, otherwise basename. Must match the remote_path used during log_file() for correct resolution.
- verbose (bool) – Whether to print a confirmation message after download. Defaults to True.
- path (str)
- remote_path (str | None)
- verbose (bool)
Returns: The local path where the file was saved (same as the input path).
Return type: str
get_model
get_model(staging_dir=None, verbose=False, version=None)
Get a model object using litmodels load_model.
Deprecated: Use experiment["key"] to access models instead.
Parameters:
- staging_dir (str | None) – Optional directory where the model will be downloaded.
- verbose (bool) – Whether to show progress bar.
- version (str | None) – Optional version string for the model.
- staging_dir (str | None)
- verbose (bool)
- version (str | None)
Return type: Any
Returns: The loaded model object.
get_model_artifact
get_model_artifact(path, verbose=False, version=None)
Download a model artifact file or directory from cloud storage using litmodels.
Deprecated: Use experiment["key"] to access model artifacts instead.
This downloads raw model files or directories that were previously uploaded via log_model_artifact(). The files are saved to the specified local path.
Parameters:
- path (str) – Path where the model should be saved locally. Directories are created if needed.
- verbose (bool) – Whether to show progress bar during download. Defaults to False.
- version (str | None) – Optional version string for the model.
- path (str)
- verbose (bool)
- version (str | None)
Returns: The local path where the model was saved (same as the input path).
Return type: str
log_file
log_file(path, remote_path=None, verbose=True)
Upload a file artifact to the cloud for this experiment.
Deprecated: Use experiment["key"] = File("path") or experiment["key"].append(File("path")) instead.
The file is uploaded to cloud storage and registered with the experiment, making it visible in the artifacts view and accessible via get_file().
Parameters:
- path (str) – Path to the local file to upload. Can be absolute or relative.
- remote_path (str | None) – Path relative to experiment root for storage and display. If None, uses the path relative to cwd if under cwd, otherwise basename. Example: remote_path=”images/0.png” will store and display as “images/0.png”.
- verbose (bool) – Whether to print a confirmation message after upload. Defaults to True.
- path (str)
- remote_path (str | None)
- verbose (bool)
Return type: None
log_files
log_files(paths, remote_paths=None, max_workers=10)
Upload multiple file artifacts to the cloud in parallel.
Deprecated: Use experiment["key"] = File("path") for each file instead.
This is more efficient than calling log_file() multiple times when you have many files, as it handles them in parallel.
Parameters:
- paths (list[str]) – List of paths to local files to upload.
- remote_paths (list[str] | None) – Optional list of remote paths, one for each file in paths. If provided, must have same length as paths. If None, each file uses its default remote path (relative to cwd or basename).
- max_workers (int) – Maximum number of concurrent uploads. Defaults to 10.
- paths (list[str])
- remote_paths (list[str] | None)
- max_workers (int)
Return type: None
log_media
log_media(name, path, kind=None, step=None, epoch=None, caption=None, verbose=False)
Upload a media file (image, text, etc.) to the experiment.
Deprecated: Use experiment["key"].append(Image(...)) or experiment["key"].append(Text(...)) instead.
Parameters:
- name (str) – Name of the media.
- path (str) – Local path to the media file.
- kind (MediaType | None) – Type of media (MediaType.IMAGE or MediaType.TEXT). If None, attempts to guess from file extension or mime type.
- step (int | None) – Optional training step.
- epoch (int | None) – Optional training epoch.
- caption (str | None) – Optional caption for the media.
- verbose (bool) – Whether to print a confirmation message after upload.
- name (str)
- path (str)
- kind (MediaType | None)
- step (int | None)
- epoch (int | None)
- caption (str | None)
- verbose (bool)
Raises:
- ValueError – If the file type cannot be determined or is not supported.
- FileNotFoundError – If the file does not exist.
Return type: None
log_metadata
log_metadata(metadata=None, **kwargs)
Add or update metadata tags on the experiment.
Deprecated: Use experiment["key"] = "value" instead.
Merges the provided key-value pairs into the experiment’s existing metadata and pushes the update to the cloud immediately.
Parameters:
- metadata (dict[str, str] | None) – Dictionary of metadata key-value pairs to add or update. Example: {“optimizer”: “adam”, “lr”: “0.001”}.
- **kwargs (str) – Additional metadata as keyword arguments. Example: optimizer=”adam”, lr=”0.001”.
- metadata (dict[str, str] | None)
- kwargs (str)
Return type: None
log_metrics
log_metrics(metrics=None, step=None, **kwargs)
Log metrics to the experiment with background uploading.
Deprecated: Use experiment["key"].append(value, step=step) instead.
Metrics are buffered locally and uploaded to the cloud in batches to optimize performance. The batch is sent when either 1 second has passed or 1000 values have been logged.
Parameters:
- metrics (dict[str, float] | None) – Dictionary mapping metric names to numeric values. Example: {“loss”: 0.5, “accuracy”: 0.95}.
- step (int | None) – Optional step number for this data point (e.g., training step, epoch). If None and store_step=True, no step is recorded.
- kwargs (float) – Additional metric values. Can be used to provide metrics more natural. Example: loss=0.5, accuracy: 0.95.
- metrics (dict[str, float] | None)
- step (int | None)
- kwargs (float)
Raises:
- RuntimeError – If the background thread encountered an error.
Return type: None
log_metrics_batch
log_metrics_batch(metrics)
Log a batch of metrics through the background queue.
Deprecated: Use experiment["key"].extend(values, start_step=step) instead.
This method converts the batch format to Metrics objects and pushes them through the background queue, which handles batching and chunking to respect API limits.
Example:
{
"loss": [
{"step": 0, "value": 1.0},
{"step": 1, "value": 0.5},
],
"accuracy": [
{"step": 0, "value": 0.6},
{"step": 1, "value": 0.8},
],
}Raises:
- RuntimeError – If the background thread encountered an error.
Parameters:
- metrics (dict[str, list[dict[str, float]]]) – Dictionary mapping metric names to lists of dicts with “step” and “value” keys.
- metrics (dict[str, list[dict[str, float]]])
Return type: None
Parameters:
Return type: None
log_model
log_model(model, staging_dir=None, verbose=False, version=None, metadata=None)
Save and upload a model object to cloud storage using litmodels.
Deprecated: Use experiment["key"] = File("path") instead.
This saves a live model object (e.g., PyTorch module, LightningModule) to disk using framework-specific serialization, then uploads it to the litmodels registry.
For uploading pre-saved model files, use log_model_artifact() instead.
Parameters:
- model (Any) – The model object to save and upload (e.g., torch.nn.Module, LightningModule).
- staging_dir (str | None) – Optional local directory for staging the model before upload. If None, uses a temp directory.
- verbose (bool) – Whether to show progress bar during upload. Defaults to False.
- version (str | None) – Optional version string for the model.
- metadata (dict[str, str] | None) – Optional metadata dictionary to store with the model (e.g., hyperparameters, metrics).
- model (Any)
- staging_dir (str | None)
- verbose (bool)
- version (str | None)
- metadata (dict[str, str] | None)
Returns: Information about the uploaded model (details from litmodels).
Return type: str
log_model_artifact
log_model_artifact(path, verbose=False, version=None)
Upload a model file or directory to cloud storage using litmodels.
Deprecated: Use experiment["key"] = File("path") instead.
This uploads raw model files (e.g., weights.pt, checkpoint.ckpt) or entire directories to the litmodels registry. Use this when you have pre-saved model files.
For saving model objects directly, use log_model() instead.
Parameters:
- path (str) – Path to the local model file or directory to upload.
- verbose (bool) – Whether to show progress bar during upload. Defaults to False.
- version (str | None) – Optional version string for the model.
- path (str)
- verbose (bool)
- version (str | None)
Return type: None
print_url
print_url()
Print the experiment URL and initialization info with styled output.
Return type: None
update
update(data)
Bulk-update the experiment with multiple keys at once.
Dispatches each value based on its type:
str → metadata (same as experiment[“key”] = “value”) File → static file artifact (same as experiment[“key”] = file) float/int → append a single metric point (same as experiment[“key”].append(value)) list → extend a time series (same as experiment[“key”].extend(values))
Parameters:
- data (dict[str, str | float | int | File | list[float | int | File]]) – Dictionary mapping keys to values of mixed types.
- data (dict[str, str | float | int | File | list[float | int | File]])
Return type: None
property artifacts
property artifacts: dict[str, File | Series]
Get all artifacts (static files and file series) logged to this experiment.
Returns: Mapping of artifact keys to File (static) or Series (time series of files).
Return type: dict[str, File | Series]
property metadata
property metadata: dict[str, str]
Get the metadata associated with this experiment from the metrics stream.
Returns: The metadata dictionary with key-value pairs from code-defined tags.
Return type: dict[str, str]
property metrics
property metrics: dict[str, Series]
Get all metric time series logged to this experiment.
Returns: Mapping of metric names to their series of values.
Return type: dict[str, Series]
property teamspace
property teamspace: Teamspace
Get the teamspace for this experiment.
Returns: The teamspace object.
Return type: Teamspace
property url
property url: str
Get the direct URL to view this experiment in the Lightning.ai web interface.
Returns: The full URL to the experiment’s visualization page.
Return type: str
Media Wrappers
class File
class litlogger.media.File(path, description='')
Bases: object
Represents a file to be logged to the experiment.
Parameters:
- path (str) – Path to the local file.
- description (str) – Optional human-readable description of the file.
- path (str)
- description (str)
save
save(path)
Download the remote file to a local path.
Only works for files that have been uploaded to an experiment.
Parameters:
Returns: The local path where the file was saved.
Return type: str
Raises:
- RuntimeError – If the file has no remote download context.
class Image
class litlogger.media.Image(data, format='png', description='')
Bases: File
Represents an image to be logged.
Can take a file path (str) or a Python object (PIL Image, numpy array, or torch Tensor) and will render it to a temporary file for upload.
Parameters:
- data (Any) – The image data - a file path string, PIL Image, numpy array, or torch Tensor.
- format (str) – Image format for rendering objects to disk (default: “png”).
- description (str) – Optional human-readable description of the image.
- data (Any)
- format (str)
- description (str)
class Text
class litlogger.media.Text(content, description='')
Bases: File
Represents text content to be logged.
Takes a string and writes it to a temporary file for upload.
Parameters:
- content (str) – The text string to log.
- description (str) – Optional human-readable description of the text.
- content (str)
- description (str)
class Model
class litlogger.media.Model(data, name=None, version=None, metadata=None, staging_dir=None, description='', _kind=None)
Bases: File
Represents a model to be logged.
Can take either a Python model object or a local path to a pre-saved model artifact. Uploads are handled through litmodels rather than the artifact API.
Parameters:
- data (Any) – Python model object or path to a pre-saved model file/directory.
- name (str | None) – Optional registry name override for this model. Defaults to the experiment name.
- version (str | None) – Optional model version. Defaults to "latest".
- metadata (dict[str, str] | None) – Optional metadata to associate with the model upload.
- staging_dir (str | None) – Optional local staging directory for object-based uploads.
- description (str) – Optional human-readable description of the model.
- data (Any)
- name (str | None)
- version (str | None)
- metadata (dict[str, str] | None)
- staging_dir (str | None)
- description (str)
- _kind (str | None)
classmethod from_remote
classmethod from_remote(model_name, kind, version=None)
Create a remote-bound model wrapper for resumed experiments.
Return type: Model
Parameters:
load
load(staging_dir=None)
Load a remote model object via litmodels.
Return type: Any
Parameters:
Series
class Series
class litlogger.series.Series(experiment, key)
Bases: object
A list-like proxy for time-series data that supports append and extend.
Tracks either metric values (floats) or file series (File objects). The type is determined by the first value appended and cannot be mixed.
Parameters:
- experiment (
Experiment) - key (str)
append
append(value, step=None)
Append a value to the time series.
Parameters:
- value (float | File) – A float/int for metric series, or a File for file series.
- step (int | None) – Optional step number for this data point (e.g., training step, epoch).
- value (float | File)
- step (int | None)
Raises:
- TypeError – If value type doesn’t match existing series type or is unsupported.
Return type: None
extend
extend(values, start_step=None)
Extend the time series with multiple values.
Parameters:
- values (list[float | int | File]) – List of values to append.
- start_step (int | None) – Optional starting step number. Each subsequent value gets start_step, start_step+1, start_step+2, etc.
- values (list[float | int | File])
- start_step (int | None)
Return type: None
Types
class MediaType
class litlogger.types.MediaType(*values)
Type of media to upload.
| Name | Value |
|---|---|
| FILE | 'file' |
| IMAGE | 'image' |
| MODEL | 'model' |
| TEXT | 'text' |
class PhaseType
class litlogger.types.PhaseType(*values)
Phase of a metrics store lifecycle.
| Name | Value |
|---|---|
| COMPLETED | 'completed' |
| FAILED | 'failed' |
| PENDING | 'pending' |
| RUNNING | 'running' |
| STOPPED | 'stopped' |
class MetricValue
class litlogger.types.MetricValue(value, step=None, created_at=None)
Bases: object
A single metric value with optional step and timestamp.
Parameters:
| Name | Value |
|---|---|
| value | |
| step | |
| created_at |
class Metrics
class litlogger.types.Metrics(name, values=)
Bases: object
A collection of metric values for a named metric.
Parameters:
| Name | Value |
|---|---|
| name | |
| values |
LightningLogger
Deprecated compatibility alias for Lightning/Fabric integration. Prefer lightning.pytorch.loggers.LitLogger, or use litlogger.init.init() and the dict-style Experiment API for standalone usage.
class LightningLogger
class litlogger.logger.LightningLogger(*args, **kwargs)
Bases: LitLogger
Deprecated compatibility alias for the upstream Lightning LitLogger.
Deprecated since 2026.03.17: Use lightning.pytorch.loggers.LitLogger for Lightning/Fabric integration, or use litlogger.init.init() and the dict-style Experiment API for standalone scripts.
Initialize the LightningLogger.
Example:
from lightning.pytorch import Trainer
from lightning.pytorch.demos.boring_classes import BoringModel, BoringDataModule
from lightning.pytorch.loggers.litlogger import LitLogger
class LoggingModel(BoringModel):
def training_step(self, batch, batch_idx: int):
loss = self.step(batch)
# logging the computed loss
self.log("train_loss", loss)
return {"loss": loss}
trainer = Trainer(
max_epochs=10,
enable_model_summary=False,
logger=LitLogger("./lightning_logs", name="boring_model")
)
model = BoringModel()
data_module = BoringDataModule()
trainer.fit(model, data_module)
trainer.test(model, data_module)Parameters:
- root_dir – Folder where logs and metadata are stored (default: ./lightning_logs).
- name – Name of your experiment (defaults to a generated name).
- teamspace – Teamspace name where charts and artifacts will appear.
- metadata – Extra metadata to associate with the experiment as tags.
- log_model – If True, automatically log model checkpoints as artifacts.
- save_logs – If True, capture and upload terminal logs.
- checkpoint_name – Override the base name for logged checkpoints.
- args (Any)
- kwargs (Any)
Was this page helpful?
Thanks for the feedback.