加载中…
加载中…
tokenizer/qwen_embed_fp16.bin 778 MBweights/dit_double0_bfl_bf16_w4a16_weights_sha256_d0209f8538f41eaabea09c62de2e57190288f0aed21aad034e850f7f37973abb.bin 637 MBweights/dit_single0_bfl_bf16_w4a16_weights_sha256_1736e65c0475b9aaae57408dd6c581d30361085cc734646119a9f65c27b43bee.bin 613 MBweights/dit_single2_bfl_bf16_w4a16_weights_sha256_2ea4eec19104cfcae841137579218f66f7db16d7672e8217504e035981e556a7.bin 613 MBweights/dit_single1_bfl_bf16_w4a16_weights_sha256_dc110d8c96c2b255e2a34946188539f86f20d760aab1a68b19ad9b1cb53a3ea9.bin 595 MBweights/dit_single3_bfl_bf16_w4a16_weights_sha256_9a8b50266cba0817a272de450152efba6eab9fc7f16d6f44392c5dda3b822e96.bin 595 MBweights/dit_double1_bfl_bf16_w4a16_weights_sha256_e98480b6af0bbe39e9e628fdc3e71d8e626b106f583e636ca35e22ff0af51914.bin 462 MBweights/dit_prep_bfl_bf16_w4a16_weights_sha256_95942692584435c7f907d096c2379f3bda8ca1437bf22cd099dd353a27a233d4.bin 331 MBweights/dit_final_bfl_bf16_w4a16_weights_sha256_d79081ff2a09206368cb9c3922b4614348dd3c0d6e08594cc0fe2d9c2ef946b8.bin 39 MBhost/time_guidance_embed_bf16.bin 20 MBThe fastest measured generation times for this model package in Gestura are:
| Device | Memory | Text-to-image | Two-image composition |
|---|---|---|---|
| Samsung Galaxy S26 | 12 GB | 9 seconds | 12 seconds |
| Samsung Galaxy S22 | 8 GB | 1 minute 20 seconds | 1 minute 57 seconds |
These are the fastest measurements observed in Gestura on the specified devices. They do not guarantee performance in other applications, runtimes, or devices.
| Text-to-Image Generation | Two-Image Composition | Instruction-Based Image Editing |
|---|---|---|
Download Gestura on Google Play
This model repository does not contain the Gestura application source code or instructions for building or invoking Gestura. This document defines only the contract that third-party applications must follow to execute this model package.
| Item | Value |
|---|---|
| Model repository | ZawShiShawn/gestura-flux2-klein-4b-litert-tflite |
| Runtime payload baseline revision | 77978ac251ca6e34504b9f6638fd3e0314970071 |
| Upstream base model | black-forest-labs/FLUX.2-klein-4B |
| Upstream conversion revision | e7b7dc27f91deacad38e78976d1f2b499d76a294 |
| Qwen text-encoder source | text_encoder/ and tokenizer/ in the pinned FLUX revision above |
| Qwen architecture and attribution | Qwen3-4B; Qwen/Alibaba Cloud |
| Upstream license | Apache License 2.0 |
77978ac251ca6e34504b9f6638fd3e0314970071 is the baseline commit at which
all 43 runtime payload files were first published together. Later commits only
add or revise documentation such as README.md, LICENSE, and NOTICE.
Applications must still validate the size and SHA-256 identity of every runtime
file from the revision they download.
This public package did not fetch a separate Qwen repository or Qwen revision.
The Qwen3-4B text-encoder weights and tokenizer assets come from the fixed files
inside
black-forest-labs/FLUX.2-klein-4B@e7b7dc27f91deacad38e78976d1f2b499d76a294.
The public ke_enc*.tflite files are not the separate
Qwen/Qwen3-4B-AWQ sidecar conversion variant.
This is a derivative LiteRT/TFLite Android runtime package for FLUX.2 [klein]
4B. It is not the original PyTorch/Diffusers checkpoint, a single directly
invocable .tflite model, or an SDK.
Third-party applications must implement tokenization, tensor layout, image preprocessing and postprocessing, the four-step flow schedule, and orchestration across all graphs. Running only one graph cannot produce a complete image.
The model graphs use the LiteRT/TFLite format. Execution is not restricted to
Google's official LiteRT API, but the runtime must fully implement the contract
in Section 4, including SignatureDef, the required operations and data types,
and external-weight resolution. A runtime that does not implement this contract
cannot execute the package.
"Gestura" identifies this model package and its associated product. It does not mean that the application source code is included in the model repository.
The public package converts the DiT weights directly from the official BF16 transformer checkpoint at the pinned revision. The Qwen text encoder and VAE are packaged under their respective conversion contracts. Components use the following storage formats:
| Component | Public package format |
|---|---|
| DiT transformer | Mixed W4/INT8/FP16 weight profile |
| DiT W4 matrices | 7 matrices; activation-block Hessian GPTQ, signed INT4, input-column group size 128, FP16 scales, no zero-point |
| DiT INT8 matrices | 93 matrices; symmetric per-output-channel quantization, FLOAT32 affine scales, zero-point 0 |
| DiT FP16 support tensors | 69 tensors; converted directly from official BF16 weights to FP16 storage and converted to FLOAT32 at runtime |
| Qwen text encoder | Three graphs with embedded channelwise dynamic-range INT8 weights; public signature inputs and outputs are FLOAT32, not an AWQ4 sidecar structure |
| Token embedding | Little-endian FP16 |
| Time/guidance lookup | BF16 |
| VAE encoder/decoder | Channelwise dynamic-range INT8 weights; public signature inputs and outputs are FLOAT32 and do not use the DiT W4 profile |
W4A16 is the name of the DiT quantization profile. Only seven selected matrices are stored in 4-bit form. Activations use FP16 or FP32 paths according to the device runtime. W4A16 does not mean that every tensor in the package is INT4. The DiT W4, INT8, and FP16 payloads all come directly from the same official BF16 numerical source; earlier INT8 or INT2 intermediate artifacts were not used as the numerical source. Third parties must not requantize or rewrite any graph or sidecar, because doing so invalidates the file identities and numerical contract of the revision.
The three ke_enc*.tflite files contain embedded INT8 Qwen weights. The public
package has no separate Qwen AWQ weight sidecar. qwen_embed_fp16.bin contains
only the FP16 token-embedding table and does not contain encoder-layer weights.
The DiT W4 conversion first applies stage-candidate thresholds, then uses a DiT trajectory with no W4 matrices, where all other heavy matrices are quantized directly from BF16 to INT8, as the final relative baseline:
| Item | Fixed threshold |
|---|---|
| Stage-candidate direct-trajectory NRMSE | No greater than 0.06 |
| Stage-boundary NRMSE | No greater than 0.08 |
| Final W4 trajectory cosine similarity relative to the direct-BF16 INT8 baseline | At least 0.995 |
| Final W4 trajectory NRMSE relative to the direct-BF16 INT8 baseline | No greater than 0.05 |
| Final W4 trajectory signal ratio relative to the direct-BF16 INT8 baseline | 0.90..1.10 |
The final gate also requires the W4-to-BF16 NRMSE to be no greater than the
direct-BF16-INT8-to-BF16 baseline NRMSE multiplied by 1.15, plus 0.01.
Cosine similarity must be no lower than that baseline's BF16-relative value
minus 0.01. The public package passed candidate selection and the final
tensor-space gate.
These values do not mean that the absolute W4-to-BF16 NRMSE must be below
0.05, and they do not prove perceptual image quality or complete runtime
validation. Final packaging records keep device image-quality comparisons
separate from full runtime validation. They also do not imply pixel-identical
output for every prompt. Actual output remains affected by the seed, scheduler,
runtime numerical path, and image preprocessing and postprocessing.
Deduplication applies only to assets with identical content identity in the public package:
kc_*, kce_*, and kce2_* retain their family-specific graphs.weights/dit_* sidecar,
so 24 denoising graphs require only eight external-weight files.The model package contains three graph families:
| Workflow | Conditioning images | Graph family |
|---|---|---|
| Text-to-image | 0 | kc_* |
| Single-image editing | 1 | kce_* |
| Two-image editing | 2 | kce2_* |
Required rules:
The runtime payload contains 43 files:
8,690,686,201 bytes
approximately 8.69 GB (decimal)
approximately 8.09 GiB (binary)
.gitattributes is not part of the runtime payload and is not counted among
the 43 files.
| Group | Files | Logical size | Purpose |
|---|---|---|---|
kc_* |
8 | 381,124,584 bytes | Text-to-image family |
kce_* |
8 | 381,129,624 bytes | Single-image-edit family |
kce2_* |
8 | 381,131,304 bytes | Two-image-edit family |
ke_enc* |
3 | 2,768,074,128 bytes | Text encoder |
kv_vae* |
2 | 92,463,792 bytes | VAE encoder/decoder |
tokenizer/ |
5 | 781,107,857 bytes | Tokenizer, embedding, and fixture |
host/ |
1 | 20,447,232 bytes | Time/guidance lookup |
weights/ |
8 | 3,885,207,680 bytes | External graph-weight sidecars |
The relative directory structure must remain exactly as follows:
flux2-klein-4b/
├── kc_prep.tflite
├── kc_double0.tflite
├── kc_double1.tflite
├── kc_single0.tflite
├── kc_single1.tflite
├── kc_single2.tflite
├── kc_single3.tflite
├── kc_final.tflite
├── kce_prep.tflite
├── kce_double0.tflite
├── kce_double1.tflite
├── kce_single0.tflite
├── kce_single1.tflite
├── kce_single2.tflite
├── kce_single3.tflite
├── kce_final.tflite
├── kce2_prep.tflite
├── kce2_double0.tflite
├── kce2_double1.tflite
├── kce2_single0.tflite
├── kce2_single1.tflite
├── kce2_single2.tflite
├── kce2_single3.tflite
├── kce2_final.tflite
├── ke_enc0.tflite
├── ke_enc1.tflite
├── ke_enc2.tflite
├── kv_vae_enc.tflite
├── kv_vae.tflite
├── host/
│ └── time_guidance_embed_bf16.bin
├── tokenizer/
│ ├── qwen_embed_fp16.bin
│ ├── qwen_merges.txt
│ ├── qwen_special.txt
│ ├── qwen_vocab.txt
│ └── tokenizer_fixture.txt
└── weights/
├── dit_prep_...bin
├── dit_double0_...bin
├── dit_double1_...bin
├── dit_single0_...bin
├── dit_single1_...bin
├── dit_single2_...bin
├── dit_single3_...bin
└── dit_final_...bin
File contract:
weights/*.bin files are required external-weight sidecars used while
executing the graphs; they are not standalone models.dit_*
sidecar.The runtime must support:
SignatureDef entries by name.weights/*.bin to each graph.A general org.tensorflow.lite.Interpreter without an external-weight resolver
cannot directly execute this package. The runtime must provide
SetWeightLoader, SetExternalWeightScopedFile, or equivalent functionality.
Exact API names depend on the LiteRT build.
The external-weight resolver must locate sidecar data using the logical name, offset, and length stored in graph metadata. It must not use fuzzy filename searches or assume that an entire sidecar belongs to one tensor.
The package currently contains the following output sizes:
256x256
512x512
512x384
384x512
480x320
320x480
512x288
288x512
Width and height must each be between 256 and 512 pixels and divisible by 32. The application must confirm that all required graphs expose a signature for the requested geometry.
Denoising-graph signature names use this format:
geometry_{WIDTH}x{HEIGHT}_text_512
Applications must still enumerate the actual SignatureDef entries and must
not rely only on constructing the expected signature name.
For output dimensions W × H:
| Data | Shape/rule |
|---|---|
| Text sequence length | 512 model tokens |
| Text hidden width | 2,560 |
| Prompt-conditioning width | 7,680 |
| VAE latent | [1, 32, H/8, W/8] |
| Packed transformer latent token count | (H/16) × (W/16) |
| Packed transformer latent width | 128 |
| Transformer hidden width | 3,072 |
| Denoising steps | 4 |
Before passing any tensor to a graph, the application must validate its element count, shape, data type, and finite state. It must not hide incompatible tensors by truncating or zero-padding them.
The tokenizer uses Qwen2 byte-level BPE:
qwen_vocab.txt: token vocabulary.qwen_merges.txt: BPE merge rules.qwen_special.txt: special tokens.tokenizer_fixture.txt: implementation-conformance fixture.qwen_embed_fp16.bin: token-embedding table.Required constants:
| Item | Value |
|---|---|
| Valid tokens | 151,669 |
| Pad token ID | 151,643 |
| Fixed sequence length | 512 |
| Embedding-table rows | 151,936 |
| Embedding width | 2,560 |
| Embedding format | Little-endian, row-major FP16 |
Prompts longer than 512 model tokens must be truncated. Shorter prompts must be padded with a correct attention mask. Character count must not be used as token count.
The prompt must use this exact chat template:
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
<think>
</think>
Line breaks and special tokens are part of the contract. A tokenizer
implementation must pass tokenizer_fixture.txt before running the model.
The execution order is fixed:
ke_enc0.tflite
→ ke_enc1.tflite
→ ke_enc2.tflite
Required procedure:
Do not use only the last-stage output, and do not infer tensor semantics from input or output indices.
Single-image and two-image workflows must:
kv_vae_enc.tflite signature.[-1, 1].[1, 32, H/8, W/8] latent.Family tensor bindings are:
Text-to-image: noisy/output latent
Single-image editing: noisy/output latent, image 1 latent
Two-image editing: noisy/output latent, image 1 latent, image 2 latent
Image temporal positions are fixed: noisy/output = 0, image 1 = 10, and
image 2 = 20. Image numbers must not be inferred from file ordering or arrival
order.
initStrength.initStrength must be within 0.0..1.0.After four denoising steps:
kv_vae.tflite.[-1, 1] output to the RGB pixel range.Each family contains eight stages in a fixed order:
prep
→ double0
→ double1
→ single0
→ single1
→ single2
→ single3
→ final
Text-to-image uses kc_*, single-image editing uses kce_*, and two-image
editing uses kce2_*.
Each denoising step must:
host/time_guidance_embed_bf16.bin to construct
the 3,072-dimensional time/guidance embedding.final output.Only the noisy/output latent may be updated at each step. Image 1 and image 2 latents must remain unchanged throughout all four steps.
This document does not define application performance implementations or device-specific tuning.
Pinned upstream model version:
https://huggingface.co/black-forest-labs/FLUX.2-klein-4B/tree/e7b7dc27f91deacad38e78976d1f2b499d76a294
This package is distributed under the Apache License 2.0. A separate personal license from the converter is not required. The converter may add a copyright notice, but it must not replace upstream licensing or attribution.
The model repository contains:
LICENSE: the complete, unmodified English text of the Apache License
2.0.NOTICE: applicable Black Forest Labs and Qwen/Alibaba Cloud
attribution, conversion details, and trademark statements. The pinned FLUX
upstream revision does not itself contain a separate NOTICE file; this
file preserves applicable attribution and trademark information from the
upstream model card and documents changes made for this derivative package.Attribution statement:
Based on FLUX.2 [klein] 4B by Black Forest Labs, licensed under the
Apache License 2.0. This repository contains a converted LiteRT/TFLite
Android runtime package associated with Gestura and is not an official
Black Forest Labs Android release. Its text encoder uses the Qwen3-4B
architecture and tokenizer assets by Qwen/Alibaba Cloud as distributed inside
the pinned FLUX upstream revision; no separate Qwen repository or revision was
fetched for this public package. Gestura application source code is not included.