LocalLab: Run language models locally or in Google Collab with a friendly API
Project description
🚀 LocalLab: Your Personal AI Lab
LocalLab lets you run AI language models on your computer or Google Colab - no cloud services needed! Think of it as having ChatGPT-like capabilities right on your machine.
🤔 What is LocalLab?
LocalLab consists of two parts working together:
graph LR
A[LocalLab Server] -->|Runs| B[AI Models]
C[Your Code] -->|Uses| D[LocalLab Client] -->|Talks to| A
The Server (Your AI Engine)
Think of the server as your personal AI engine. It:
- Downloads and runs AI models on your computer
- Manages memory and resources automatically
- Optimizes performance based on your hardware
- Provides a simple API for accessing models
You can run it:
- On your computer (local mode)
- On Google Colab (free GPU mode)
The Client (Your AI Controller)
The client is how your code talks to the AI. It:
- Connects to your LocalLab server
- Sends requests for text generation
- Handles chat conversations
- Processes multiple requests at once
- Streams responses in real-time
✨ How It Works Together
When you use LocalLab:
-
Server Setup
from locallab import start_server start_server() # Server starts and loads AI model
-
Client Connection
from locallab.client import LocalLabClient server_url = "http://localhost:8000" # or "https://your-ngrok-url.ngrok.app" client = LocalLabClient(server_url)
-
AI Interaction
# Your code sends requests through the client response = await client.generate("Write a story") print(response) # Server processes and returns AI response
💡 Quick Examples
# Generate text
response = await client.generate("Hello!")
# Chat with AI
response = await client.chat([
{"role": "user", "content": "Hi!"}
])
# Process multiple prompts
responses = await client.batch_generate([
"Write a joke",
"Tell a story"
])
💻 Requirements
Local Computer:
- Python 3.8+
- 4GB RAM minimum
- GPU optional (but recommended)
Google Colab:
- Just a Google account!
- Free tier works fine
📚 Getting Started
1. Choose Your Path
New to AI/Programming?
- Start with our Getting Started Guide
- Try the Basic Examples
- Join our Community
Developer?
- Check API Reference
- See Client Libraries
- Read Advanced Features
2. Read the Docs
Our Documentation Guide will help you:
- Understand LocalLab's features
- Learn best practices
- Find solutions to common issues
- Master advanced features
🌟 Features
- Easy Setup: Just pip install and run
- Multiple Models: Use any Hugging Face model
- Resource Efficient: Automatic optimization
- Privacy First: All local, no data sent to cloud
- Free GPU: Google Colab integration
🔍 Need Help?
- Check FAQ
- Visit Troubleshooting
- Ask in Discussions
📖 Additional Resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file locallab-0.4.46.tar.gz.
File metadata
- Download URL: locallab-0.4.46.tar.gz
- Upload date:
- Size: 54.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f74ef880685a546e855db57798caf0339cacb8b087051d6c56a05ac6fe2246a4
|
|
| MD5 |
4e380d62385608a6a1614aabe2b54f66
|
|
| BLAKE2b-256 |
28be09e68774c21a8be37cb51eb73df4c360dae1b5ba0a7783e8dcd354d2fc80
|
File details
Details for the file locallab-0.4.46-py3-none-any.whl.
File metadata
- Download URL: locallab-0.4.46-py3-none-any.whl
- Upload date:
- Size: 58.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f01e749ecd87b90105b0ee399b350b0303b4ee651a17557160507616c45cf9c
|
|
| MD5 |
9baa7f1c68de71368abb7ccea60b3c5e
|
|
| BLAKE2b-256 |
42ef0ac534a6d41670b38106e6e0aa2795ec4f513a430eb66b820bf4aec5ce01
|