Skip to main content

⚡ Lightning Tune: A Production-Ready Finetuning Library

Lightning Tune is a powerful, production-grade Python library for finetuning and deploying both text-only and multi-modal Large Language Models. Built entirely on the Lightning AI ecosystem (PyTorch Lightning, LitGPT, LitServe), it provides a seamless, automated, and efficient workflow from raw data to a deployed API.

Features

  • Smart Configuration: Automatically analyze your dataset's schema and size to determine a strong baseline configuration for finetuning.
  • Smart Hyperparameter Tuning: Infers sensible starting points for Learning Rate, Number of Epochs, and LoRA Rank based on your dataset size.
  • Flexible Multi-Modal Architecture: Define multi-modal towers explicitly in your code or let the smart factory detect them for you.
  • Advanced PEFT Methods: Natively supports QLoRA, LoRA, and DoRA for text-only finetuning via Hugging Face's SFTTrainer.
  • End-to-End Workflow: A unified API takes you from training to a production-ready inference server.
  • Interactive UI: A Gradio-based web interface for a no-code, point-and-click finetuning experience.

Installation

# Clone the repository (or create the project from the provided code)
cd lightning-tune

# Create and activate a virtual environment
uv venv
source .venv/bin/activate

# Install the library and its testing dependencies in editable mode
uv pip install -e ".[test]"

How to Use

Let the library analyze your dataset and choose the best starting configuration.

# examples/run_smart_multimodal.py
import lightning_tune as lt
from pathlib import Path

# The model repo_id is a mandatory argument
config = lt.PipelineConfig.from_dataset(
    model_repo_id="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
    file_path=Path("examples/sample_data_multimodal.csv"),
    image_root_path=Path("examples/")
)

# You can still override any smart setting
config.trainer.max_epochs = 2

trained_model_path = lt.run_finetuning(config)
if trained_model_path.exists():
    lt.launch_server(config, trained_model_path)

2. Manual Configuration (Full Control)

Explicitly define every aspect of your pipeline, including multi-modal towers.

# examples/run_manual_multimodal.py
import lightning_tune as lt
from pathlib import Path

config = lt.PipelineConfig(
    model=lt.ModelConfig(repo_id="TinyLlama/TinyLlama-1.1B-Chat-v1.0"),
    data=lt.DataConfig(
        file_path=Path("examples/sample_data_multimodal.csv"),
        image_root_path=Path("examples/"),
        text_columns=["product_description"],
        output_column="customer_review",
        vision_config=lt.VisionConfig(
            image_column="image_path",
            projection_dim=2048 # Manually set to match TinyLlama's hidden size
        ),
        tabular_config=lt.TabularConfig(
            numerical_columns=["price"],
            categorical_columns=["category"],
            projection_dim=2048
        )
    ),
    trainer=lt.TrainerConfig(max_epochs=2),
    train=lt.TrainConfig(batch_size=1)
)
lt.run_finetuning(config)

3. Using the Gradio Web UI

For a seamless, no-code experience, launch the interactive Gradio application.

python app/main.py

4. Running Tests

pytest

Metadata

Release files for lightning-tune 2026.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lightning-tune 2026.5.1
File Size Uploaded Provenance Actions
lightning_tune-2026.5.1.tar.gz 33.8 kB Without provenance Details for lightning_tune-2026.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lightning-tune 2026.5.1
File Interpreter ABI Platform Actions
lightning_tune-2026.5.1-py3-none-any.whl Python 3 none any Details for lightning_tune-2026.5.1-py3-none-any.whl

Total release size: 71.1 kB

Release files / lightning_tune-2026.5.1.tar.gz

Download URL lightning_tune-2026.5.1.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6aea35b8af060c25c18e1e532d6617997b94af1b5cdc66582aed797419595d50
BLAKE2b-256 checksum
How to use checksums
3fb797cdf7b27b01152e2ca021f7d3a41f37d74c72351e40083c94657f8b0789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / lightning_tune-2026.5.1-py3-none-any.whl

Download URL lightning_tune-2026.5.1-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6accfcb1fdf8d7ee0a1141971f4197253354eb310c7a839bf12181c892948236
BLAKE2b-256 checksum
How to use checksums
cd1de403d78c872f34e2f3b83a71662f0d5b9f63b445156398c9098beef8b772
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for lightning-tune 2026.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2026.5.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page