leptonai  by leptonai

Python framework for simplifying AI service building

created 1 year ago
2,773 stars

Top 17.5% on sourcepulse

GitHubView on GitHub
Project Summary

Lepton AI provides a Pythonic framework for building and deploying AI services, targeting developers and researchers who want to easily expose their models as scalable APIs. It simplifies the process of converting Python-based AI code into deployable services with features like automatic batching and a native Python client for service interaction.

How It Works

Lepton AI uses a "Photon" abstraction, a Python class decorated with @Photon.handler, to define AI service endpoints. This allows users to encapsulate model inference logic within standard Python functions. The framework handles the underlying complexities of service creation, including request parsing, response serialization, and deployment configurations, enabling rapid prototyping and deployment of AI models.

Quick Start & Requirements

  • Install with: pip install -U leptonai
  • Launch a HuggingFace model (e.g., gpt2) locally with: lep photon runlocal --name gpt2 --model hf:gpt2
  • Launch Llama2 with: lep photon runlocal -n llama2 -m hf:meta-llama/Llama-2-7b-chat-hf (requires GPU access and sufficient VRAM).
  • Access services via leptonai.client.
  • Documentation: https://github.com/leptonai/leptonai
  • Examples: https://github.com/leptonai/examples

Highlighted Details

  • Pythonic abstraction (Photon) for service definition.
  • Built-in support for common models like Llama, SDXL, and Whisper via HuggingFace integration.
  • Features autobatching and background jobs for AI-tailored performance.
  • Automatic client generation for seamless service interaction in Python.
  • Gradio UI integration for accessible model interaction.

Maintenance & Community

The project is actively developed, with contributions welcomed. Links to community resources like Twitter and a blog are provided.

Licensing & Compatibility

Released under the Apache 2.0 license, permitting commercial use and integration with closed-source projects.

Limitations & Caveats

Support for HuggingFace models is limited to standard pipelines; models with custom code may not be directly compatible without modifications or custom photon implementations.

Health Check
Last commit

23 hours ago

Responsiveness

1 week

Pull Requests (30d)
38
Issues (30d)
1
Star History
38 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems) and Robert Stojnic Robert Stojnic(Creator of Papers with Code).

Agent-S by simular-ai

1.2%
6k
Agentic framework for autonomous computer interaction
created 9 months ago
updated 17 hours ago
Feedback? Help us improve.