radames/flux2-klein-edge-web
FLUX.2 Klein 4B — browser weights
The weights behind radames/flux-klein-web, a demo that runs the full FLUX.2 Klein 4B pipeline inside a browser tab: the transformer in hand-written WGSL (WebGPU), the distilled text encoder and BFL's distilled VAE through onnxruntime-web. The page streams these files straight into the browser and keeps them in the origin private file system, so a second visit starts in seconds.
This repo holds weights only. The engine is the flux-klein.js npm package (the WGSL transformer, the ONNX text encoder and VAE, the OPFS cache); the demo page lives in the Space. The package fetches from this repo by default:
import { createFluxKlein } from "flux-klein.js";
const klein = await createFluxKlein(); // base: https://huggingface.co/radames/flux2-klein-edge-web/resolve/main
const { rgba, width, height } = await klein.generate({ prompt: "a red bicycle", width: 256, height: 256 });Layout
Every web_weights*/ set is one manifest.json describing tensors as byte ranges into w0.bin … w<n-1>.bin (raw little-endian bytes, 16-byte aligned). Loaders validate each shard's length against the manifest and each cached file against the Hub's ETag, so a re-upload here invalidates browser caches on its own.
What a page downloads on first run: desktop ≈ 5 GB (web_weights, te_onnx, vae_onnx); phone ≈ 3.2 GB (web_weights_mobile, te_onnx_slim, vae_onnx); 2 steps add the LoRA.
Provenance
Quantized from black-forest-labs/FLUX.2-klein-4B. int8 is per-row absmax; int4 is asymmetric group-wise along K. End-to-end parity against the f32-dequantized reference is rel-L2 ≈ 1e-2 (bf16-scale rounding noise).
The weights are released under the FLUX.2 Klein license linked above; using them means accepting it.
