gandamu/flux2-klein-4b-qwen3-4b-webgpu
FLUX.2 [klein] 4B + Qwen3-4B — quantized WebGPU bundles
Quantized, browser-streamable repacks of [FLUX.2 [klein] 4B](https://huggingface.co/black-forest-labs/FLUX.2-klein-4B) (rectified-flow image transformer + VAE) and Qwen3-4B (as the text encoder — hidden-state taps at layers 9/18/27), packed for fully client-side WebGPU inference: no server-side compute, weights fetched with plain HTTP GETs and streamed straight into GPU buffers.
The bundle layout is purpose-built for streaming into WebGPU (not a standard interchange format like safetensors or GGUF): each bundle directory holds a manifest.json (tensor table, shard offsets, tokenizer/chat-template segments) plus shard_NNN.bin files (~250 MB each) — CDN/CORS friendly, cacheable as immutable content.
Quality
Validated end-to-end against the original-weights reference implementation (fp32 eager) on identical inputs:
- transformer velocity field: cosine ≥ 0.9998
- VAE decode: cosine ≥ 0.99999; VAE encode: cosine ≈ 1.0
- Qwen3 hidden-state taps (q4): cosine ≥ 0.998 at all three taps
- tokenizer: exact match on multilingual/emoji probe set
- Grounding DINO: reference detections reproduced end-to-end (IoU > 0.9, scores within ±0.03, labels exact) vs fp32 eager
- SAM 2.1: reference masks reproduced at IoU 0.998+ with matching predicted-IoU scores
An int4 variant of the image transformer failed these gates (velocity cosine 0.96) and is deliberately not published.
Runtime requirements
A consuming runtime needs WebGPU with ~8 GB of GPU/unified memory for flux2-q8 + qwen3-q4; shader-f16 is used when available. Validated on Chrome (Vulkan, D3D12, and Metal backends) and Safari 26+. Character-reference conditioning (multi-image) is supported natively by the packed transformer weights.
License and attribution
Both source models are licensed under the Apache License 2.0; these repacks are derivative works distributed under the same license. See NOTICE for required attributions and the full statement of modifications (quantization parameters, omitted layers, format changes).
Not affiliated with or endorsed by Black Forest Labs Inc., Alibaba Cloud, IDEA-Research, or Meta Platforms. "FLUX" is a trademark of Black Forest Labs Inc., used here only to describe the origin of the weights.
