Lakonik/LakonLab
PyTorch research stack for training and distilling few-step flow models
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
LakonLab is a config-driven PyTorch research codebase that houses pi-H3, AsymFlow, pi-Flow and GMFlow under one training and evaluation stack. The tree separates configs/, data/, demo/ and the lakonlab/ package, with train.py and test.py at the root. The dependency manifest pins mmcv 1.6.1, Transformers 5.16.1, Diffusers 0.40.0 and PEFT 0.20.0. Data loaders and checkpoint I/O can use local storage or S3, and checkpoints can also be loaded directly from Hugging Face or HTTP(S).
Model configuration is the main extension point for execution: compile_forward enables per-module torch.compile, bucket_warmup compiles shape variants up front, and attention_backend_config selects attention backends by module. Distributed execution can use DDP, FSDP or FSDP2. In LoRA workflows, the teacher, student and EMA models can share underlying base-weight storage with DDP or FSDP; that compatibility is narrower than the list of available distributed modes.
Key Capabilities & Differentiators
pi-Flow uses imitation distillation for few-step generation; AsymFlow and GMFlow provide asymmetric flow and Gaussian mixture flow-matching implementations. The pi-FLUX.2 variant supports four-step image generation and editing. pi-H3 supports video and audio generation in two or four steps, with optional Sol sparse attention on supported GPUs; the video path does not use a VAE decoder.
FlowSDEScheduler and FlowMapSDEScheduler expose the same stochasticity control for conventional flow and few-step flow maps respectively: h=0 selects ODE sampling, h=1 selects standard SDE sampling, and h='inf' selects full re-noising. Frozen linear layers can use W8A8 presets including FP8, blockwise FP8 and INT8 variants. Evaluation in v0.3.0 adds VBench, LongText-Bench and video warping error, with video and audio support in both evaluation and the media viewer.
Trade-offs & Limitations
Choose LakonLab over a standard Diffusers inference pipeline when you need to change distillation, solver behavior or distributed training. For supported checkpoint inference in a visual workflow, the separate ComfyUI extension is a lighter entry point. The two- or four-step schedules count sampling steps, not end-to-end latency; compare at matched resolution and clip length, and measure cold and warm runs separately when compiling.
Per-module compilation and attention tuning offer control at the cost of shape warmup and GPU-specific compatibility checks. The optional CUTLASS INT8 GEMM extension is Hopper-only, with a Triton path available when that extension is not used. Frozen-layer quantization and shared LoRA base weights address specific memory costs, not the entire training footprint. Budget VRAM against the chosen checkpoint, precision, resolution, clip length and batch size rather than treating a supported sampling mode as a hardware guarantee.
Hardware & Deployment Guide
Use a Linux GPU environment: Ubuntu 20 and newer were tested with PyTorch 2.9+, most extensively on 2.10 and 2.11. The example environment uses uv-managed Python 3.10, setuptools<74, PyTorch 2.10.0 and torchvision 0.25.0 from the cu128 index, followed by an editable install with --no-build-isolation. Optional extensions can build on first use; source builds require compatible nvcc and a supported C++ compiler. Check LD_LIBRARY_PATH if system CUDA libraries conflict with the PyTorch build. Sol attention is a separate extra, with an additional CuTe runtime dependency on CUDA 13 builds.
The CLI workflow can run locally with local data and checkpoints. S3 and remote checkpoint loading are optional; gated FLUX weights require accepting access conditions and authenticating with Hugging Face. For upgrades, v0.2.2 introduced persistent S3 caching and renamed AsymFlow's base_rank option to basis_rank, so older configs need migration. v0.3.0 added pi-H3, frozen-layer 8-bit quantization and expanded media evaluation.
GPU-equipped research teams reproducing or modifying few-step image and video models, comparing stochastic solvers, or running distributed LoRA distillation with explicit control over kernels and evaluation.
You only need a standard inference pipeline, a turnkey hosted API, or predictable deployment without validating model access, VRAM and CUDA compatibility.
Quick Start & Installation
# Move to this repository (the folder with setup.py) after cloning cd <PATH_TO_YOUR_LOCAL_REPO> # Create uv environment (uv's managed Python includes the headers needed to build CUDA extensions) uv venv --python 3.10 --managed-python source .venv/bin/activate # Install the build tool required by --no-build-isolation uv pip install "setuptools<74" # Install Pytorch. Goto https://pytorch.org/get-started/previous-versions/ to select the appropriate version uv pip install torch==2.10.0 torchvision==0.25.0 --index-url https://download.pytorch.org/whl/cu128 # Install LakonLab in editable mode uv pip install -e . --no-build-isolation
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/Lakonik/LakonLab.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about LakonLab
How do I integrate LakonLab into a research or ComfyUI workflow?
Can I size this for a single GPU?
Does Apache-2.0 cover commercial self-hosting?
When should I choose LakonLab over Diffusers or ComfyUI?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy