Optimized inference and fine-tuning framework for diffusion (image & video) models.
Project description
HyperGen
Train & run diffusion models 3x faster with 80% less VRAM
Optimized inference and fine-tuning framework for image & video diffusion models.
✨ Simple as 5 Lines
from hypergen import model, dataset
m = model.load("stabilityai/stable-diffusion-xl-base-1.0")
ds = dataset.load("./my_images")
lora = m.train_lora(ds, steps=1000)
That's it! HyperGen handles optimization, memory management, and acceleration automatically.
🚀 Features
- Dead Simple API: Train LoRAs in 5 lines of code
- Universal: Works with FLUX, SDXL, SD3, CogVideoX, and more
- Optimized: Built on top of diffusers, PEFT, and PyTorch
- Flexible: Simple for beginners, powerful for experts
Installation
pip install hypergen
From Source
git clone https://github.com/ntegrals/hypergen.git
cd hypergen
pip install -e .
Quick Start
Load a Dataset
from hypergen import dataset
# Load images from a folder
ds = dataset.load("./my_training_images")
print(f"Loaded {len(ds)} images")
# Supports captions too!
# Just put a .txt file next to each image:
# my_images/
# photo1.jpg
# photo1.txt <- "A beautiful sunset"
# photo2.jpg
# photo2.txt <- "A mountain landscape"
Train a LoRA
from hypergen import model, dataset
# Load model
m = model.load("stabilityai/stable-diffusion-xl-base-1.0")
m.to("cuda")
# Load dataset
ds = dataset.load("./my_images")
# Train LoRA
lora = m.train_lora(ds, steps=1000)
Advanced Options
# Customize everything
lora = m.train_lora(
ds,
steps=2000,
learning_rate=5e-5,
rank=32, # LoRA rank
alpha=64, # LoRA alpha
batch_size=2, # Or "auto"
save_steps=500, # Save checkpoints
output_dir="./checkpoints"
)
Generate Images
# Basic generation
image = m.generate("A cat holding a sign that says hello world")
# With options
images = m.generate(
["A sunset", "A mountain"],
num_inference_steps=30,
guidance_scale=7.5
)
🎯 Supported Models
HyperGen works with any diffusion model from HuggingFace:
- FLUX.1:
black-forest-labs/FLUX.1-dev - SDXL:
stabilityai/stable-diffusion-xl-base-1.0 - SD 3:
stabilityai/stable-diffusion-3-medium-diffusers - CogVideoX:
THUDM/CogVideoX-5b(video) - Any other diffusers-compatible model
🌐 Serve Models (OpenAI-Compatible API)
HyperGen provides a production-ready API server with request queuing, similar to vLLM:
Start Server
# Basic serving
hypergen serve stabilityai/stable-diffusion-xl-base-1.0
# With authentication
hypergen serve stabilityai/stable-diffusion-xl-base-1.0 \
--api-key token-abc123
# With LoRA
hypergen serve stabilityai/stable-diffusion-xl-base-1.0 \
--lora ./my_lora \
--api-key token-abc123
# Custom settings
hypergen serve black-forest-labs/FLUX.1-dev \
--port 8000 \
--dtype bfloat16 \
--max-queue-size 100 \
--max-batch-size 4
Use with OpenAI Client
from openai import OpenAI
# Point to your HyperGen server
client = OpenAI(
api_key="token-abc123",
base_url="http://localhost:8000/v1"
)
# Generate images (OpenAI-compatible API)
response = client.images.generate(
model="sdxl",
prompt="A cat holding a sign that says hello world",
n=2,
size="1024x1024"
)
Features
- OpenAI-Compatible: Drop-in replacement for OpenAI's image generation API
- Request Queue: Automatic request batching and queuing
- LoRA Support: Load and switch LoRAs dynamically
- Authentication: Optional API key authentication
- Production-Ready: Built on FastAPI + uvicorn
See examples/serve_client.py for complete examples.
📖 Examples
Check out the examples/ directory:
- quickstart.py - Minimal 5-line example
- complete_example.py - All features demonstrated
- serve_client.py - API client examples
🏗️ Architecture
hypergen/
├── model/ # Model loading and management
├── dataset/ # Dataset handling
├── training/ # LoRA training pipelines
├── serve/ # API server and queue management
├── inference/ # Inference optimizations
└── optimization/ # Performance improvements
🛣️ Roadmap
Phase 1: ✅ Core Architecture
- Model loading
- Dataset handling
- LoRA training scaffold
- OpenAI-compatible API server
- Request queue management
- Complete training loop implementation
Phase 2: ⚡ Optimizations
- Gradient checkpointing
- Mixed precision training
- Flash Attention support
- Auto-configuration
- Request batching for inference
Phase 3: 🚀 Advanced Features
- Multi-GPU training
- Multi-GPU serving
- Video model support
- Custom CUDA kernels
- LoRA hot-swapping
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
📄 License
MIT
📜 Project History
Note on Aura Voice: This repository previously hosted Aura Voice, an early tech demo showcasing AI voice capabilities. As the underlying technology evolved significantly beyond that initial demonstration, the demo is no longer representative of current capabilities and has been deprecated.
Thank you to everyone who supported and used Aura Voice! The original code remains accessible at commit 00c18d2 for reference.
HyperGen represents a new direction focused on optimized diffusion model training and serving.
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 hypergen-0.1.0.tar.gz.
File metadata
- Download URL: hypergen-0.1.0.tar.gz
- Upload date:
- Size: 249.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
466552168eb6754ca43f5c5ca89e8cfab518e9ff989c4723c0655cb7c533f420
|
|
| MD5 |
8416c1c18fb74a9a5df09f6f2b3665e2
|
|
| BLAKE2b-256 |
f13cd1d0366b7c6517c807c24b0b1e22ceb26f057a65fe222768bea7b91958fe
|
File details
Details for the file hypergen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hypergen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e6ac3447eb2c52ceedd53577ba94569e24c4dbd5a12f3afec02cb47a33ea8fa
|
|
| MD5 |
b180930dc54fce38623fad9548aadacc
|
|
| BLAKE2b-256 |
a49bc8f09a367e09219412ecdb3c9d0f2a2d618b4249aff68b9e84f04db92395
|