FLUX.2 [klein] 4B (Sentis, float16)
This is an unofficial conversion of FLUX.2 [klein] 4B by Black Forest Labs, for Unity Inference Engine. The model files are modified versions of the original weights: they are converted to Inference Engine's .sentis format, with weights quantized to float16. The original Apache License 2.0 terms apply. See LICENSE.md.
Load the .sentis files directly, without conversion. They take 13.1 GiB. Other version: uint8.
How the files were made
The source is the ONNX export in julienkay/FLUX.2-klein-4B-onnx. Its card describes the export and the inputs and outputs of each part.
Each part was converted with tools.doji.onnx-model-loader as OnnxModelLoader.Save(onnxPath, sentisPath, QuantizationType.Float16). It writes the weights from the ONNX file to the .sentis file one at a time, so it never holds all the weights in memory.
- The weights of the MatMul, Gemm, Conv, ConvTranspose and Gather layers are float16. Rank-1 tensors such as biases stay float32.
- Each weight is cast to float32 right before its first use, so only the float32 weights in use are on the device.
The files were saved with Inference Engine 2.6. A later Inference Engine version may need them converted again from the ONNX files.
Validation
The image below came from these files in Unity with Flux2KleinPipeline from tools.doji.diffusers. Prompt: "A photo of a red fox sitting in a snowy forest, golden hour". Settings: 4 steps, guidance scale 1, 512 ร 512. The initial latents are torch.randn((1, 128, 32, 32), generator=torch.Generator("cpu").manual_seed(42)).
diffusers 0.43 with the original model in float32, with the same prompt, settings and latents, gives the same image: the PSNR between the two is 65.6 dB.
Model tree for julienkay/FLUX.2-klein-4B-sentis-float16
Base model
black-forest-labs/FLUX.2-klein-4B