Skip to main content

A production-ready library for automated, advanced multi-modal LLM finetuning and deployment.

Project description

⚡ 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

1. The Smart Factory (Recommended)

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightning_tune-2026.5.1.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightning_tune-2026.5.1-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file lightning_tune-2026.5.1.tar.gz.

File metadata

  • Download URL: lightning_tune-2026.5.1.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for lightning_tune-2026.5.1.tar.gz
Algorithm Hash digest
SHA256 6aea35b8af060c25c18e1e532d6617997b94af1b5cdc66582aed797419595d50
MD5 93ac5e30bf68cbc6f30b579df1321969
BLAKE2b-256 3fb797cdf7b27b01152e2ca021f7d3a41f37d74c72351e40083c94657f8b0789

See more details on using hashes here.

File details

Details for the file lightning_tune-2026.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lightning_tune-2026.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6accfcb1fdf8d7ee0a1141971f4197253354eb310c7a839bf12181c892948236
MD5 2c566af2fdb9d44361e11fdad576c5aa
BLAKE2b-256 cd1de403d78c872f34e2f3b83a71662f0d5b9f63b445156398c9098beef8b772

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page