Skip to content

HyperGen - Optimized inference and fine-tuning framework for diffusion (image & video) models. Up to 3x faster & 80% less VRAM.

License

Notifications You must be signed in to change notification settings

ntegrals/hypergen

HyperGen

HyperGen (Alpha)

Train & run diffusion models 3x faster with 80% less VRAM

Optimized inference and fine-tuning framework for image & video diffusion models.

Status Python License

✨ Train in 5 Lines

Train LoRAs on diffusion models with minimal code. Add your images, run the script, and export your trained LoRA.

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.

πŸ““ Interactive Notebooks

Try HyperGen in interactive Jupyter notebooks:

Notebook Description Time Colab
Minimal Example 5-minute quickstart - see it work immediately ~5 min Open In Colab
LoRA Training Quickstart Complete tutorial: dataset β†’ training β†’ inference β†’ comparison ~15 min Open In Colab

Notebooks include:

  • Loading datasets from HuggingFace
  • Training LoRAs with real diffusion models
  • Generating images with trained models
  • Side-by-side comparisons

⚑ Quickstart

pip install hypergen

From Source

git clone https://github.com/ntegrals/hypergen.git
cd hypergen
pip install -e .

🎯 Supported Models

Model Family Model ID Type
FLUX.1-dev black-forest-labs/FLUX.1-dev Image
FLUX.1-schnell black-forest-labs/FLUX.1-schnell Image (Fast)
SDXL stabilityai/stable-diffusion-xl-base-1.0 Image
SDXL Turbo stabilityai/sdxl-turbo Image (Fast)
SD 3 Medium stabilityai/stable-diffusion-3-medium-diffusers Image
SD v1.5 runwayml/stable-diffusion-v1-5 Image

Universal Support: HyperGen works with any diffusers-compatible model from HuggingFace.

πŸ“– Usage Examples

Train a LoRA

from hypergen import model, dataset

# Load model and dataset
m = model.load("stabilityai/stable-diffusion-xl-base-1.0")
m.to("cuda")
ds = dataset.load("./my_images")

# Train LoRA
lora = m.train_lora(ds, steps=1000)

Load Dataset with Captions

from hypergen import dataset

# Load images from a folder
ds = dataset.load("./my_training_images")
print(f"Loaded {len(ds)} images")

# Supports captions! 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"

Advanced Training 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
)

🌐 Serve Models (OpenAI-Compatible API)

HyperGen provides a production-ready API server with request queuing, similar to vLLM.

Start the 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"
)

API Server Features:

  • OpenAI-compatible drop-in replacement for image generation
  • Automatic request batching and queuing
  • Dynamic LoRA loading and switching
  • Optional API key authentication
  • Production-ready (FastAPI + uvicorn)

⭐ Key Features

  • Dead Simple API: Train LoRAs in 5 lines of code - simple for beginners, powerful for experts
  • Universal Model Support: Works with FLUX, SDXL, SD3, and any diffusers-compatible model
  • Optimized Performance: 3x faster training with 80% less VRAM
  • Production Serving: OpenAI-compatible API server with request queuing
  • Built on Best Practices: Leverages diffusers, PEFT, and PyTorch under the hood

πŸ“– Examples

Notebooks

Interactive Jupyter notebooks with complete tutorials in notebooks/:

Python Scripts

Code samples in the examples/ directory:

πŸ›£οΈ Roadmap

Phase 1: Core Architecture βœ…

  • Model loading and management
  • Dataset handling with caption support
  • LoRA training implementation
  • OpenAI-compatible API server
  • Request queue management
  • Training loop with noise prediction

Phase 2: Optimizations ⚑

  • Gradient checkpointing
  • Mixed precision training
  • Flash Attention support
  • Auto-configuration for optimal performance
  • Request batching for inference

Phase 3: Advanced Features πŸš€

  • Multi-GPU training support
  • Multi-GPU serving
  • Custom CUDA kernels
  • Hot-swappable LoRAs

πŸ—οΈ Architecture

hypergen/
β”œβ”€β”€ model/        # Model loading and management
β”œβ”€β”€ dataset/      # Dataset handling with captions
β”œβ”€β”€ training/     # LoRA training pipelines
β”œβ”€β”€ serve/        # API server and queue management
β”œβ”€β”€ inference/    # Inference optimizations
└── optimization/ # Performance improvements

πŸ’Ύ Installation

Basic Installation

pip install hypergen

From Source

git clone https://github.com/ntegrals/hypergen.git
cd hypergen
pip install -e .

Requirements: Python 3.10+

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

πŸ“„ License

MIT License - see LICENSE for details.

πŸ”— Links and Resources

Type Links
πŸ“š Examples View Examples Directory
πŸ› Issues Report Issues
πŸ’¬ Discussions Join Discussions

πŸ“œ 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.