After installing the required library, you can run the following script:
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
"diffusers/FLUX.1-dev-bnb-4bit",
torch_dtype=torch.bfloat16
)
pipe.to("cuda")
prompt = "Baroque style, a lavish palace interior with ornate gilded ceilings, intricate tapestries, and dramatic lighting over a grand staircase."
pipe_kwargs = {
"prompt": prompt,
"height": 1024,
"width": 1024,
"guidance_scale": 3.5,
"num_inference_steps": 50,
"max_sequence_length": 512,
}
image = pipe(
**pipe_kwargs, generator=torch.manual_seed(0),
).images[0]
image.save("flux.png")
How to generate this quantized checkpoint ?
This checkpoint was created with the following script using "black-forest-labs/FLUX.1-dev" checkpoint:
import torch
from diffusers import FluxPipeline
from diffusers import BitsAndBytesConfig as DiffusersBitsAndBytesConfig
from diffusers.quantizers import PipelineQuantizationConfig
from transformers import BitsAndBytesConfig as TransformersBitsAndBytesConfig
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": TransformersBitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16),
}
)
pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev",
quantization_config=pipeline_quant_config,
torch_dtype=torch.bfloat16
)
pipe.save_pretrained("FLUX.1-dev-bnb-4bit")
Runs of diffusers FLUX.1-dev-bnb-4bit on huggingface.co
828
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
366
30-day runs
More Information About FLUX.1-dev-bnb-4bit huggingface.co Model
FLUX.1-dev-bnb-4bit huggingface.co
FLUX.1-dev-bnb-4bit huggingface.co is an AI model on huggingface.co that provides FLUX.1-dev-bnb-4bit's model effect (), which can be used instantly with this diffusers FLUX.1-dev-bnb-4bit model. huggingface.co supports a free trial of the FLUX.1-dev-bnb-4bit model, and also provides paid use of the FLUX.1-dev-bnb-4bit. Support call FLUX.1-dev-bnb-4bit model through api, including Node.js, Python, http.
FLUX.1-dev-bnb-4bit huggingface.co is an online trial and call api platform, which integrates FLUX.1-dev-bnb-4bit's modeling effects, including api services, and provides a free online trial of FLUX.1-dev-bnb-4bit, you can try FLUX.1-dev-bnb-4bit online for free by clicking the link below.
diffusers FLUX.1-dev-bnb-4bit online free url in huggingface.co:
FLUX.1-dev-bnb-4bit is an open source model from GitHub that offers a free installation service, and any user can find FLUX.1-dev-bnb-4bit on GitHub to install. At the same time, huggingface.co provides the effect of FLUX.1-dev-bnb-4bit install, users can directly use FLUX.1-dev-bnb-4bit installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
FLUX.1-dev-bnb-4bit install url in huggingface.co: