HyperGAN logo HyperGAN v2.2.0
HyperGAN v2.2.0

Train generative models. Follow their progress. Export the result.

Declarative hypergan-model/1 TOML configs, pure HNDL neural network graphs, ParticleGAN unified_v12 optimization, a real-time Foldlite DB Web Observatory, and standalone generator export from one CLI and typed Python API.

$ python -m pip install "torch==2.14.0" "torchvision==0.29.0" \
    --index-url https://download.pytorch.org/whl/cu130
$ python -m pip install "hypergan[all]==2.2.0"
$ python -m pip install "torch==2.14.0" "torchvision==0.29.0" \
    --index-url https://download.pytorch.org/whl/cpu
$ python -m pip install "hypergan[all]==2.2.0"
$ git clone https://github.com/HyperGAN/HyperGAN.git && cd HyperGAN
$ python -m pip install -e ".[all]"
colorization-128 · HNDL L(G(gray, z)) == gray (< 1e-5)
128x128 HNDL particle colorizer conditioning a grayscale HG monogram into 16 diverse colorizations
Conditional L→AB Particle Colorization

128×128 HNDL particle colorizer · 16 draws · exact 7-face polytope luminance lock · packaged in the wheel as colorization-128.

256×256 Colorization
6.37FID-10k
DINOv3 Logo Colorizer

2× RTX A6000 · ParticleGAN 0.9.7 BISPF · step 2,500 · luma err 2.61e-7

CIFAR-10 · 32×32
14.56FID-50k
Tiny Transformer + ResNet-18 Critic

2× RTX A6000 · batch 256 · 15k steps BISPF (15.16 @ 12.5k EMPF)

Multi-GPU NCCL Scaling
2.20×speedup
1,517.19 img/s on 2× RTX A6000

Global batch 256 (110.2% eff., 1.52 GiB VRAM/GPU; batch 64 was 0.79×)

Typed Surface & Serving
129API symbols
Torch-free import · 4 export formats

Python 3.11–3.14 · bundle, pt2, onnx, safetensors · 85 HNDL ops

One Coherent Stack

CLI, Python API, TOML, and HNDL — aligned by design.

Every training run records its resolved recipe, network source, and telemetry stream so CLI runs and Python scripts share the same registry and export artifacts.

Explore all 52 CLI commands →
18 TOML sections · 85 HNDL ops
Shell
# 1. Scaffold an image GAN project auto-sized from your image folder
hypergan new --project my_gan --dataset ./images

# 2. Validate configuration & HNDL shapes without importing PyTorch
hypergan validate my_gan/configs/dcgan.toml

# 3. Train with live Web Observatory telemetry and global run registration
hypergan train my_gan/configs/dcgan.toml --steps 1000 -n baseline-128

# 4. Monitor from any directory, sample EMA generator, and export standalone
hypergan status baseline-128
hypergan sample baseline-128 --count 16 --seed 42
hypergan export baseline-128 --checkpoint latest -o generator.pt
Python
import hypergan as hg

def main():
    # Torch-free config loading, overrides, and static validation
    model = hg.load("my_gan/configs/dcgan.toml")
    model = hg.override(model, {"train.steps": 1000, "train.batch_size": 32})
    warnings = hg.validate(model)

    # Launch training, inspect typed RunStatus, and tag the run
    run = hg.train(model, "my_gan/runs/exp1", steps=1000)
    st = hg.status("exp1")
    hg.tag("exp1", "baseline-128")

    # Export and reload a standalone EMA generator bundle
    bundle = hg.export("baseline-128", checkpoint="latest")
    gen = hg.load_bundle(bundle, device="cuda")
    samples = gen.sample(count=16, seed=42)
    walk = gen.interpolate(seed_a=100, seed_b=200, steps=10, mode="slerp")

if __name__ == "__main__":
    main()
TOML
format = "hypergan-model/1"
name = "colorization-128"
defaults = "particlegan"

[data]
builtin = "image_folder"
args = { root = "./data", height = 128, width = 128, mode = "RGB", alpha = "composite_white" }

[prior]
kind = "particles"
z_dim = 128
num_particles = 10000

[networks.luma]
role = "auxiliary"
inputs = { x = "batch.real" }
input_shape = ["B", 3, 128, 128]
output_shape = ["B", 1, 128, 128]
source = """
r, gb = split(x, 1)
g, b = split(gb, 1)
out = add(add(scale(r, 0.299), scale(g, 0.587)), scale(b, 0.114))
"""

[networks.generator]
role = "generator"
inputs = { z = "latent", gray = "luma" }
input_shape = { z = ["B", 128], gray = ["B", 1, 128, 128] }
output_shape = ["B", 3, 128, 128]
hndl = "examples/networks/colorization-generator-128.hndl" 
HNDL
# 1. Multi-scale residual grayscale U-Net encoder (128 -> 64 -> 32 -> 16 -> 8)
e128 = resblock(gray, 16, norm="group_norm", groups=4, name="enc128")
e64  = resblock(e128, 32, stride=2, norm="group_norm", groups=8, name="enc64")
e32  = resblock(e64,  64, stride=2, norm="group_norm", groups=8, name="enc32")
e16  = resblock(e32, 128, stride=2, norm="group_norm", groups=8, name="enc16")
e8   = resblock(e16, 256, stride=2, norm="group_norm", groups=8, name="enc8")

# 2. RoPE + SwiGLU Transformer bottleneck with particle palette cross-attention
palette_tokens = reshape(linear(z, 2048, name="palette_tokens"), 8, 256)
tokens = permute(reshape(e8, 256, 64), 2, 1)
for _ in range(2):
    tokens = transformer_block(tokens, 4, mlp_ratio=2, norm="layer_norm", rope=True, ffn_kind="swiglu", name="bottleneck_block")
    attended = cross_attention(layer_norm(tokens, name="xattn_norm"), palette_tokens, 4, name="palette_xattn")
    tokens = add(tokens, attended)

# 3. Sub-pixel U-Net skip decoder with shape-inferred adaptive_norm
h16 = pixel_shuffle(conv(reshape(permute(layer_norm(tokens, name="bottleneck_norm"), 2, 1), 256, 8, 8), 512, kernel_size=3, padding=1, name="up16_conv"), 2)
h16 = adaptive_norm(resblock(concat(h16, e16), 128, norm="group_norm", groups=8, name="dec16"), linear(z, name="style16"), name="adain16")
Architecture

Built for reproducible generative research and deployment.

01 / DECLARATIVE

hypergan-model/1 + HNDL

Declare data, priors, multi-port HNDL networks (or custom PyTorch nn.Modules), losses, and evaluations in versioned TOML with static shape verification before allocating a GPU.

Inspect 111 schema fields →
02 / OPTIMIZATION

ParticleGAN unified_v12

Learned latent particle tables with coupled_max multi-critic thermal coordination and dual-safe fwAD softmax penalties for mode coverage and stable convergence.

Read integration boundary →
03 / OBSERVABILITY

Web Observatory + Foldlite DB WASM

Append-only Foldlite DB journals drive a local browser observatory with a shared Rust/WASM streaming reducer, live loss/FID curves, EMA preview sliders, and inline HNDL layer tables.

Web Observatory guide →
04 / SCALING

Multi-GPU NCCL Scaling

Launch single-host replicated training with --devices 0,1, bounded preview budgets, resumable checkpoints, and explicit execution profiles for CPU, CUDA, and Docker.

View scaling measurements →
05 / DEPLOYMENT

Standalone Generator Export

Bake EMA generator weights with SHA-256 provenance into Python bundles (bundle), PyTorch pt2, onnx, or safetensors — with sample() and spherical interpolate().

Deployment guide →
06 / OPERATIONS

Docker-Style Run Registry & Queue

Daemonless global registry tracks every run by short ID, memorable slug (fleet-hawk), or custom tag. Control runs from any directory with ps, status, logs, stop, gc, and a multi-GPU job queue.

CLI command reference →
Shipped In The Wheel

Zero-copy recipes ready to validate and train.

Run any packaged wheel recipe by name or browse all TOML configs, Python API demos, HNDL networks, and execution profiles in the Examples Gallery.

Browse all examples →
Documentation Pathways

Jump straight to the surface you need.