This package derives from FLUX.2 [klein] 4B
and generates 320 × 320 RGB images from text. It combines a Hugging Face tokenizer, LiteRT models,
and an ExecuTorch decoder. The text encoder and denoiser use INT4 per-channel quantized weights.
The manifest defaults to two denoising steps; its num_steps setting can select three or four steps.
The random seed is configurable.
FLUX.2 [klein] 4B is a distilled image-generation model developed by Black Forest Labs. This package provides its text-to-image path at a fixed 320 × 320 resolution.
Follow these steps to run FLUX.2 [klein] 4B - INT4 Per-Channel Image Generation with Compute Flow on macOS® with Apple silicon, such as a MacBook Pro® computer, or on Linux® with an Arm®-based CPU, such as an Amazon EC2 instance powered by AWS Graviton4 processors.
git clone https://github.com/ARM-software/compute-flow.git && cd compute-flow
uv sync && source .venv/bin/activate
compute-flow update
compute-flow model install image_generation:flux2-klein-generation flux2klein-4b-generation-int4-320px
compute-flow build native
python -m cli_examples.image_generation_cli \
-m @manifest/flux2_klein_generation/flux2klein-4b-generation-int4-320px/flux2_klein_generation_manifest.json \
-p "A photorealistic blue ceramic coffee mug beside a croissant" \
-o flux2-klein.png
The CLI saves the generated 320 × 320 RGB image to flux2-klein.png.
No quantitative image-quality evaluation is reported for this package.
| CPU threads | Mean generation latency (s) | p50 (s) | p90 (s) | p99 (s) |
|---|---|---|---|---|
| 1 | 4.56 | 4.54 | 4.71 | 5.41 |
| 2 | 2.35 | 2.31 | 2.44 | 2.68 |
| Component | Framework / format | Role |
|---|---|---|
assets/tokenizer.json |
Hugging Face tokenizer | Encodes the formatted prompt. |
text_encoder.tflite |
LiteRT / TFLite | Produces text features. |
denoiser.tflite |
LiteRT / TFLite | Updates the image latent for each denoising step. |
vae_decode.pte |
ExecuTorch | Decodes the latent to an image. |
The text encoder and denoiser use INT4 per-output-channel linear weights with dynamic INT8 activations. Their other floating-point operations and interfaces use FP32. The decoder uses FP16 convolutions with FP32 normalization and interfaces.
| Input | Format | Description |
|---|---|---|
| Prompt | UTF-8 text | Image description; at most 128 tokens after chat formatting. |
| Seed | Nonnegative 64-bit integer | Controls the initial noise; default 42. |
| Denoising steps | Integer | 2, 3, or 4; default 2. |
| Output | Format | Description |
|---|---|---|
| Image | RGB image | 320 × 320 pixels. |
flux2_klein_generation_manifest.json — model manifest with a two-step default.assets/tokenizer.json — text tokenizer.text_encoder.tflite, denoiser.tflite, and vae_decode.pte — model components.metadata.yaml — publication metadata.SHA256SUMS — package file checksums.The model files and tokenizer derive from the Black Forest Labs release.
SHA256SUMS was generated by recursively hashing every regular file in the model bundle,
including files in subdirectories, except the generated root SHA256SUMS and paths with a
dotfile component.
From the model bundle root, verify the checked-out files with:
shasum -a 256 -c SHA256SUMS