You need to agree to share your Hugging Face information to access this model
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
By clicking "Agree", you agree to the FLUX Non-Commercial License Agreement and acknowledge the Acceptable Use Policy.
Log in or Sign Up to review the conditions and access this model content.
FLUX.2 [klein] 9B โ Core AI (4-bit)
Black Forest Labs' FLUX.2 [klein] 9B converted to Core AI, Apple's on-device ML runtime in macOS 27, for text-to-image and image editing on Apple silicon Macs. Apple's coreai-models only ships a 4B recipe; this is the 9B, quantized the same way (INT4 symmetric, per-block 32) from the original BF16 weights.
FLUX.2 [klein] is step-distilled: 4 steps at guidance 1.0. The 9B pairs a 32-block flow-matching transformer (8 double + 24 single) with a Qwen3-8B text encoder.
Folders
Each folder is a complete bundle (metadata.json v0.2, tokenizer/, VAE batch-norm stats, all .aimodels).
| Folder | Transformer | Use with |
|---|---|---|
macos-int4/ |
standard, 8 entrypoints | apple/coreai-models FlowTransformerPipeline, diffusion-runner (same interface as Apple's 4B export) |
macos-int4-lora/ |
same weights + live LoRA slots (rank 256) | apps that pass the two LoRA inputs (see below) |
| Asset | Size |
|---|---|
Transformer.aimodel (main, half, img2img_{full,half,quarter} at 1024 and 512) |
4.8 GB |
TextEncoder.aimodel (Qwen3-8B, hidden states of layers 9/18/27 โ 12288) |
3.9 GB |
VAEDecoder, VAEDecoder_half, VAEEncoder, VAEEncoder_half (fp16) |
0.3 GB |
| Bundle | 9.0 GB |
Requires macOS 27 on Apple silicon. Tested on an M3 Pro with 18 GB, where it runs stage by stage
(lazyModelLoading): load ~1 min, a 1024ร1024 edit ~2โ2.5 min. Macs with more memory can keep it resident.
Use it (apple/coreai-models)
The macos-int4/ transformer has the same inputs, outputs and entrypoints as the 4B transformer Apple's
exporter produces, and the bundle follows the same metadata.json v0.2 layout. The 9B itself was tested
end to end through a Swift app built on coreai-models' components (text-to-image and editing, with and
without LoRAs); the commands below are the standard coreai-models ones.
hf download dwancin/FLUX.2-klein-9B-CoreAI-4bit --include "macos-int4/*" --local-dir FLUX.2-klein-9B-CoreAI-4bit
swift run -c release diffusion-runner --model FLUX.2-klein-9B-CoreAI-4bit/macos-int4 \
--prompt "a red fox in fresh snow, photo" --steps 4 --guidance-scale 1.0
import CoreAIDiffusionPipeline
let pipeline = try await FlowTransformerPipeline(from: bundleURL)
let result = try await pipeline.generateImages(configuration: PipelineConfiguration(
prompt: "a red fox in fresh snow, photo", stepCount: 4, guidanceScale: 1.0, schedulerType: .discreteFlow))
For image editing set startingImage and referenceGrid (.full, .half, .quarter).
LoRA slots (macos-int4-lora/)
Core AI compiles weights into the model, so LoRAs can't be patched in afterwards. This transformer instead has a low-rank path on every attention and MLP projection (144 layers) whose weights are two extra inputs:
lora_a: [256, a_columns] every layer's A matrix, side by side
lora_b: [b_rows, 256] every layer's B matrix, stacked
y = Wยทx + B_lยท(A_lยทx) A_l, B_l sliced at the offsets in lora_slots.json
lora_slots.json lists each slot (diffusers module name, in/out features, offsets). All-zero inputs reproduce the
base model exactly. To apply LoRAs, map their layers onto the slots (BFL double_blocks.N.img_attn.qkv splits into
to_q/to_k/to_v with a shared A), stack several along the rank axis (up to 256 in total), and fold strength into
B. Measured on 4B: about 1% slower per step than the standard transformer. FLUX.2 [klein] 9B LoRAs only.
How it was made
The 9B doesn't fit coreai-models' export on an 18 GB Mac (it loads the whole pipeline in float16 first). These
bundles were built by loading and quantizing one linear layer at a time with coreai-models' own quantizer, wrappers
and multi-function export; the same tool reproduces Apple's 4B transformer bit-for-bit. The VAE and tokenizer are
identical to the 4B's. Source: coreai-models be11f01, coreai-torch 0.4.3.
License
The FLUX.2 [klein] 9B weights are licensed under the FLUX Non-Commercial License; this conversion is a derivative under the same terms. Not affiliated with Black Forest Labs or Apple.
Model tree for dwancin/FLUX.2-klein-9B-CoreAI-4bit
Base model
black-forest-labs/FLUX.2-klein-9B