Instructions to use WaveCut/FLUX.2-klein-4B-OrbitQuant-W2A4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use WaveCut/FLUX.2-klein-4B-OrbitQuant-W2A4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("WaveCut/FLUX.2-klein-4B-OrbitQuant-W2A4", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
black-forest-labs/FLUX.2-klein-4B OrbitQuant W2A4
This repository contains a compact OrbitQuant transformer-component artifact for the source Diffusers model listed above. It is intended to be loaded into the original pipeline, not used as a standalone Diffusers pipeline repository.
OrbitQuant is a calibration-free post-training quantization method for image and video diffusion transformers. This artifact keeps the text encoders, VAE, embeddings, timestep MLP, and final heads in the source precision by default and replaces the transformer linear projections with OrbitQuant modules.
Usage
Install OrbitQuant and the Hugging Face runtime dependencies:
pip install "orbitquant[hf,kernels]>=0.2.0"
Download this model repository as an OrbitQuant artifact, then load the source Diffusers pipeline with the quantized component patched in:
import torch
from huggingface_hub import snapshot_download
from orbitquant import load_quantized_pipeline_from_artifact
artifact_id = "WaveCut/FLUX.2-klein-4B-OrbitQuant-W2A4"
artifact_dir = snapshot_download(artifact_id, repo_type="model")
pipe = load_quantized_pipeline_from_artifact(
artifact_dir,
torch_dtype=torch.bfloat16,
runtime_mode="auto_fused",
)
pipe.enable_model_cpu_offload(device="cuda")
image = pipe(
prompt="A precise product photo of a red ceramic mug on a wooden desk",
height=1024,
width=1024,
num_inference_steps=4,
guidance_scale=1.0,
).images[0]
image.save("flux2-klein-orbitquant.png")
runtime_mode="auto_fused" is the default optimized runtime. On CUDA, the kernels extra provides the Triton packed fallback; a locally built native CUDA package is preferred automatically when installed. On MPS, build and install the native Metal package from the OrbitQuant source tree. See the OrbitQuant runtime instructions. Use runtime_mode="dequant_bf16" only as an explicit compatibility/debug reference path.
Native Settings
Use these settings when comparing this artifact against the BF16 source model or the visual assets below:
| Setting | Value |
|---|---|
| Pipeline | Flux2KleinPipeline |
| Resolution | 1024x1024 |
| Inference steps | 4 |
| Guidance scale | 1.0 |
| Output | image |
| Scope | extra target; not an OrbitQuant paper reproduction model |
Validation Status
- Native BF16-vs-OrbitQuant comparison: included when the visual matrix below is present.
- Release-grade paper metrics: not applicable to this extra target.
- The model card reports artifact-level validation status only.
Native Validation Evidence
The compact benchmark summary records native BF16-vs-OrbitQuant evidence for the comparison matrix below. Detailed per-sample generation records are retained outside this compact artifact.
| Evidence | Value |
|---|---|
| Comparison matrix | assets/image_generation_comparison_matrix.webp |
| Paired prompt/seed count | 1 |
| BF16 source generated samples | 1 |
| BF16 source generated frames | 0 |
| BF16 source nonempty outputs | 1 |
| OrbitQuant generated samples | 1 |
| OrbitQuant generated frames | 0 |
| OrbitQuant nonempty outputs | 1 |
Quantization
- Method:
orbitquant - Bits:
W2A4 - Runtime mode:
auto_fused - Activation kernel backend:
auto - Activation normalization epsilon:
1e-10 - Quantization device:
cuda - Weight quantization backend:
triton_cuda - Target policy:
flux2 - AdaLN policy:
int4_rtn_group64_bf16_activation - AdaLN group size:
64 - AdaLN group-size note: paper default.
- Rotation:
rpbh - Rotation seed:
0 - Block size:
paper - Block size policy:
largest_power_of_two_dividing_dim - Codebook:
lloyd_max - Codebook version:
2 - Quantized transformer modules:
100 - AdaLN INT4 modules:
3 - Skipped modules:
6 - Calibration data: none
- Text encoders and VAE: left in source precision by default
Visual Comparison
The following assets are stored in this artifact and compare the BF16 base generation against the OrbitQuant generation with the same prompt and seed.
Source
- Model:
black-forest-labs/FLUX.2-klein-4B - Revision:
e7b7dc27f91deacad38e78976d1f2b499d76a294 - Source license:
apache-2.0 - OrbitQuant paper: https://arxiv.org/abs/2607.02461
Artifact Files
model.safetensors: packed OrbitQuant/INT4 module tensors.quantization_config.json: serialized OrbitQuant runtime settings.orbitquant_manifest.json: source provenance, policies, module lists, and checksums.orbitquant_codebooks.safetensors: Lloyd-Max codebooks.orbitquant_rotations.safetensors: deterministic RPBH rotation metadata.
Limitations
- This is a transformer-component artifact; load it into the source pipeline as shown above.
- CUDA and MPS
auto_fusedinference requires a packed matmul kernel and fails loudly when the required kernel is unavailable. The explicitdequant_bf16reference mode materializes dequantized weights before BF16 matmul. - Quality depends on the source model and bit setting. Very low-bit settings can degrade prompt following or visual detail.
- Downloads last month
- 103
Model tree for WaveCut/FLUX.2-klein-4B-OrbitQuant-W2A4
Base model
black-forest-labs/FLUX.2-klein-4B