This is a
DFloat11 losslessly compressed
version of the original
black-forest-labs/FLUX.1-Kontext-dev
model. It reduces model size by
32%
compared to the original BFloat16 model, while maintaining
bit-identical outputs
and supporting
efficient GPU inference
.
🔥🔥🔥 Thanks to DFloat11 compression, FLUX.1-Kontext-dev can now run smoothly on a single 24GB GPU without any quality loss. 🔥🔥🔥
📊 Performance Comparison
Metric
FLUX.1-Kontext-dev (BFloat16)
FLUX.1-Kontext-dev (DFloat11)
Model Size
23.80 GB
16.33 GB
Peak GPU Memory
(1024×1024 image generation)
24.86 GB
18.12 GB
Generation Time
(A100 GPU)
72 seconds
83 seconds
🔧 How to Use
Install or upgrade the DFloat11 pip package
(installs the CUDA kernel automatically; requires a CUDA-compatible GPU and PyTorch installed)
:
pip install -U dfloat11[cuda12]
# or if you have CUDA version 11:# pip install -U dfloat11[cuda11]
Install diffusers from the main branch until future stable release.
To use the DFloat11 model, run the following example code in Python:
import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
from dfloat11 import DFloat11Model
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
DFloat11Model.from_pretrained(
"DFloat11/FLUX.1-Kontext-dev-DF11",
device="cpu",
bfloat16_model=pipe.transformer,
)
pipe.enable_model_cpu_offload()
input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
image = pipe(
image=input_image,
prompt="Add a hat to the cat",
guidance_scale=2.5,
).images[0]
image.save("kontext.png")
🔍 How It Works
We apply
Huffman coding
to losslessly compress the exponent bits of BFloat16 model weights, which are highly compressible (their 8 bits carry only ~2.6 bits of actual information). To enable fast inference, we implement a highly efficient CUDA kernel that performs on-the-fly weight decompression directly on the GPU.
The result is a model that is
~32% smaller
, delivers
bit-identical outputs
, and achieves performance
comparable to the original
BFloat16 model.
Runs of DFloat11 FLUX.1-Kontext-dev-DF11 on huggingface.co
1.7K
Total runs
-30
24-hour runs
-273
3-day runs
-378
7-day runs
-48
30-day runs
More Information About FLUX.1-Kontext-dev-DF11 huggingface.co Model
FLUX.1-Kontext-dev-DF11 huggingface.co
FLUX.1-Kontext-dev-DF11 huggingface.co is an AI model on huggingface.co that provides FLUX.1-Kontext-dev-DF11's model effect (), which can be used instantly with this DFloat11 FLUX.1-Kontext-dev-DF11 model. huggingface.co supports a free trial of the FLUX.1-Kontext-dev-DF11 model, and also provides paid use of the FLUX.1-Kontext-dev-DF11. Support call FLUX.1-Kontext-dev-DF11 model through api, including Node.js, Python, http.
FLUX.1-Kontext-dev-DF11 huggingface.co is an online trial and call api platform, which integrates FLUX.1-Kontext-dev-DF11's modeling effects, including api services, and provides a free online trial of FLUX.1-Kontext-dev-DF11, you can try FLUX.1-Kontext-dev-DF11 online for free by clicking the link below.
DFloat11 FLUX.1-Kontext-dev-DF11 online free url in huggingface.co:
FLUX.1-Kontext-dev-DF11 is an open source model from GitHub that offers a free installation service, and any user can find FLUX.1-Kontext-dev-DF11 on GitHub to install. At the same time, huggingface.co provides the effect of FLUX.1-Kontext-dev-DF11 install, users can directly use FLUX.1-Kontext-dev-DF11 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
FLUX.1-Kontext-dev-DF11 install url in huggingface.co: