Views
No views yet
black-forest-labs/FLUX.1-Depth-devblack-forest-labs/FLUX.1-Depth-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]1pip install -U diffusers
2pip install git+https://github.com/asomoza/image_gen_aux.git1import torch
2from diffusers import FluxControlPipeline
3from diffusers.utils import load_image
4from image_gen_aux import DepthPreprocessor
5from dfloat11 import DFloat11Model
6
7pipe = FluxControlPipeline.from_pretrained("black-forest-labs/FLUX.1-Depth-dev", torch_dtype=torch.bfloat16)
8
9DFloat11Model.from_pretrained('DFloat11/FLUX.1-Depth-dev-DF11', device='cpu', bfloat16_model=pipe.transformer)
10
11prompt = "A robot made of exotic candies and chocolates of different kinds. The background is filled with confetti and celebratory gifts."
12control_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png")
13
14processor = DepthPreprocessor.from_pretrained("LiheYoung/depth-anything-large-hf")
15control_image = processor(control_image)[0].convert("RGB")
16
17image = pipe(
18 prompt=prompt,
19 control_image=control_image,
20 height=1024,
21 width=1024,
22 num_inference_steps=30,
23 guidance_scale=10.0,
24 generator=torch.Generator().manual_seed(42),
25).images[0]
26image.save("output.png")