Views
No views yet
black-forest-labs/FLUX.1-Fill-devblack-forest-labs/FLUX.1-Fill-dev using our custom DFloat11 format. The outputs of this compressed model are bit-for-bit identical to the original BFloat16 model, while reducing GPU memory consumption by approximately 30%.1pip install -U dfloat11[cuda12]
2# or if you have CUDA version 11:
3# pip install -U dfloat11[cuda11]pip install -U diffusers1import torch
2from diffusers import FluxFillPipeline
3from diffusers.utils import load_image
4from dfloat11 import DFloat11Model
5
6image = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup.png")
7mask = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup_mask.png")
8
9pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16)
10pipe.enable_model_cpu_offload()
11
12DFloat11Model.from_pretrained('DFloat11/FLUX.1-Fill-dev-DF11', device='cpu', bfloat16_model=pipe.transformer)
13
14image = pipe(
15 prompt="a white paper cup",
16 image=image,
17 mask_image=mask,
18 height=1632,
19 width=1232,
20 guidance_scale=30,
21 num_inference_steps=50,
22 max_sequence_length=512,
23 generator=torch.Generator("cpu").manual_seed(0)
24).images[0]
25image.save(f"flux-fill-dev.png")