Flux-Kontext-dev model outputs using BnB&Hqq 4bit quantization
Original Input
BnB 4-bit (DiT) & Hqq 4-bit (T5)
Usage with Diffusers
To use this quantized FLUX.1 [dev] checkpoint, you need to install the 🧨 diffusers, transformers, bitsandbytes and hqq library:
pip install git+https://github.com/huggingface/diffusers.git@main # add support for `FluxKontextPipeline`
pip install transformers>=4.53.1 # add support for hqq quantized model in diffusers pipeline
pip install -U bitsandbytes
pip install -U hqq
After installing the required library, you can run the following script:
import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
pipe = FluxKontextPipeline.from_pretrained("HighCWu/FLUX.1-Kontext-dev-bnb-hqq-4bit", torch_dtype=torch.bfloat16)
pipe.to("cuda")
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,
num_inference_steps=28,
generator=torch.Generator("cuda").manual_seed(0),
).images[0]
image.save(f"kontext.1-dev.png")
How to generate this quantized checkpoint ?
This checkpoint was created with the following script using "black-forest-labs/FLUX.1-Kontext-dev" checkpoint:
import torch
assert torch.cuda.is_available() # force initialization of cudafrom diffusers import FluxKontextPipeline
from diffusers import BitsAndBytesConfig as DiffusersBitsAndBytesConfig
from diffusers.quantizers import PipelineQuantizationConfig
from transformers import HqqConfig as TransformersHqqConfig
pipeline_quant_config = PipelineQuantizationConfig(
quant_mapping={
"transformer": DiffusersBitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16),
"text_encoder_2": TransformersHqqConfig(nbits=4, group_size=64),
}
)
pipe = FluxKontextPipeline.from_pretrained(
"black-forest-labs/FLUX.1-Kontext-dev",
quantization_config=pipeline_quant_config,
torch_dtype=torch.bfloat16
)
pipe.save_pretrained("FLUX.1-Kontext-dev-bnb-hqq-4bit")
Runs of HighCWu FLUX.1-Kontext-dev-bnb-hqq-4bit on huggingface.co
139
Total runs
0
24-hour runs
-49
3-day runs
-120
7-day runs
-250
30-day runs
More Information About FLUX.1-Kontext-dev-bnb-hqq-4bit huggingface.co Model
FLUX.1-Kontext-dev-bnb-hqq-4bit huggingface.co
FLUX.1-Kontext-dev-bnb-hqq-4bit huggingface.co is an AI model on huggingface.co that provides FLUX.1-Kontext-dev-bnb-hqq-4bit's model effect (), which can be used instantly with this HighCWu FLUX.1-Kontext-dev-bnb-hqq-4bit model. huggingface.co supports a free trial of the FLUX.1-Kontext-dev-bnb-hqq-4bit model, and also provides paid use of the FLUX.1-Kontext-dev-bnb-hqq-4bit. Support call FLUX.1-Kontext-dev-bnb-hqq-4bit model through api, including Node.js, Python, http.
FLUX.1-Kontext-dev-bnb-hqq-4bit huggingface.co is an online trial and call api platform, which integrates FLUX.1-Kontext-dev-bnb-hqq-4bit's modeling effects, including api services, and provides a free online trial of FLUX.1-Kontext-dev-bnb-hqq-4bit, you can try FLUX.1-Kontext-dev-bnb-hqq-4bit online for free by clicking the link below.
HighCWu FLUX.1-Kontext-dev-bnb-hqq-4bit online free url in huggingface.co:
FLUX.1-Kontext-dev-bnb-hqq-4bit is an open source model from GitHub that offers a free installation service, and any user can find FLUX.1-Kontext-dev-bnb-hqq-4bit on GitHub to install. At the same time, huggingface.co provides the effect of FLUX.1-Kontext-dev-bnb-hqq-4bit install, users can directly use FLUX.1-Kontext-dev-bnb-hqq-4bit installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
FLUX.1-Kontext-dev-bnb-hqq-4bit install url in huggingface.co: