Skip to content

Commit a1ff390

Browse files
committed
pipeline example
1 parent 4b446b3 commit a1ff390

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/diffusers/pipelines/z_image/pipeline_z_image_controlnet.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
3636
Examples:
3737
```py
3838
>>> import torch
39-
>>> from diffusers import ZImagePipeline
39+
>>> from diffusers import ZImageControlNetPipeline
40+
>>> from diffusers import ZImageControlNetModel
4041
41-
>>> pipe = ZImagePipeline.from_pretrained("Z-a-o/Z-Image-Turbo", torch_dtype=torch.bfloat16)
42+
>>> controlnet_model = "..."
43+
>>> controlnet = ZImageControlNetModel.from_pretrained(controlnet_model, torch_dtype=torch.bfloat16)
44+
45+
>>> pipe = ZImageControlNetPipeline.from_pretrained("Z-a-o/Z-Image-Turbo", controlnet=controlnet, torch_dtype=torch.bfloat16)
4246
>>> pipe.to("cuda")
4347
4448
>>> # Optionally, set the attention backend to flash-attn 2 or 3, default is SDPA in PyTorch.
@@ -47,9 +51,11 @@
4751
>>> # (2) Use flash attention 3
4852
>>> # pipe.transformer.set_attention_backend("_flash_3")
4953
50-
>>> prompt = "一幅为名为“造相「Z-IMAGE-TURBO」”的项目设计的创意海报。画面巧妙地将文字概念视觉化:一辆复古蒸汽小火车化身为巨大的拉链头,正拉开厚厚的冬日积雪,展露出一个生机盎然的春天。"
54+
>>> control_image = load_image("https://huggingface.co/InstantX/SD3-Controlnet-Canny/resolve/main/canny.jpg")
55+
>>> prompt = "A girl in city, 25 years old, cool, futuristic"
5156
>>> image = pipe(
5257
... prompt,
58+
... control_image=control_image,
5359
... height=1024,
5460
... width=1024,
5561
... num_inference_steps=9,

0 commit comments

Comments
 (0)