Skip to content

Commit c5c0a4b

Browse files
Apply style fixes
1 parent 33277c2 commit c5c0a4b

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

src/diffusers/models/controlnets/controlnet_qwenimage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ class QwenImageMultiControlNetModel(ModelMixin, ConfigMixin, PeftAdapterMixin, F
299299
r"""
300300
`QwenImageMultiControlNetModel` wrapper class for Multi-QwenImageControlNetModel
301301
302-
This module is a wrapper for multiple instances of the `QwenImageControlNetModel`. The `forward()` API is designed to be
303-
compatible with `QwenImageControlNetModel`.
302+
This module is a wrapper for multiple instances of the `QwenImageControlNetModel`. The `forward()` API is designed
303+
to be compatible with `QwenImageControlNetModel`.
304304
305305
Args:
306306
controlnets (`List[QwenImageControlNetModel]`):

src/diffusers/pipelines/qwenimage/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
else:
2525
_import_structure["modeling_qwenimage"] = ["ReduxImageEncoder"]
2626
_import_structure["pipeline_qwenimage"] = ["QwenImagePipeline"]
27+
_import_structure["pipeline_qwenimage_controlnet"] = ["QwenImageControlNetPipeline"]
2728
_import_structure["pipeline_qwenimage_edit"] = ["QwenImageEditPipeline"]
2829
_import_structure["pipeline_qwenimage_img2img"] = ["QwenImageImg2ImgPipeline"]
2930
_import_structure["pipeline_qwenimage_inpaint"] = ["QwenImageInpaintPipeline"]
30-
_import_structure["pipeline_qwenimage_controlnet"] = ["QwenImageControlNetPipeline"]
3131

3232
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
3333
try:

src/diffusers/pipelines/qwenimage/pipeline_qwenimage_controlnet.py

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,54 @@
4848
>>> from diffusers import QwenImageControlNetModel, QwenImageMultiControlNetModel, QwenImageControlNetPipeline
4949
5050
>>> # QwenImageControlNetModel
51-
>>> controlnet = QwenImageControlNetModel.from_pretrained("InstantX/Qwen-Image-ControlNet-Union", torch_dtype=torch.bfloat16)
52-
>>> pipe = QwenImageControlNetPipeline.from_pretrained("Qwen/Qwen-Image", controlnet=controlnet, torch_dtype=torch.bfloat16)
51+
>>> controlnet = QwenImageControlNetModel.from_pretrained(
52+
... "InstantX/Qwen-Image-ControlNet-Union", torch_dtype=torch.bfloat16
53+
... )
54+
>>> pipe = QwenImageControlNetPipeline.from_pretrained(
55+
... "Qwen/Qwen-Image", controlnet=controlnet, torch_dtype=torch.bfloat16
56+
... )
5357
>>> pipe.to("cuda")
5458
>>> prompt = "Aesthetics art, traditional asian pagoda, elaborate golden accents, sky blue and white color palette, swirling cloud pattern, digital illustration, east asian architecture, ornamental rooftop, intricate detailing on building, cultural representation."
5559
>>> negative_prompt = " "
56-
>>> control_image = load_image("https://huggingface.co/InstantX/Qwen-Image-ControlNet-Union/resolve/main/conds/canny.png")
60+
>>> control_image = load_image(
61+
... "https://huggingface.co/InstantX/Qwen-Image-ControlNet-Union/resolve/main/conds/canny.png"
62+
... )
5763
>>> # Depending on the variant being used, the pipeline call will slightly vary.
5864
>>> # Refer to the pipeline documentation for more details.
59-
>>> image = pipe(prompt, negative_prompt=negative_prompt, control_image=control_image, controlnet_conditioning_scale=1.0, num_inference_steps=30, true_cfg_scale=4.0).images[0]
65+
>>> image = pipe(
66+
... prompt,
67+
... negative_prompt=negative_prompt,
68+
... control_image=control_image,
69+
... controlnet_conditioning_scale=1.0,
70+
... num_inference_steps=30,
71+
... true_cfg_scale=4.0,
72+
... ).images[0]
6073
>>> image.save("qwenimage_cn_union.png")
6174
6275
>>> # QwenImageMultiControlNetModel
63-
>>> controlnet = QwenImageControlNetModel.from_pretrained("InstantX/Qwen-Image-ControlNet-Union", torch_dtype=torch.bfloat16)
76+
>>> controlnet = QwenImageControlNetModel.from_pretrained(
77+
... "InstantX/Qwen-Image-ControlNet-Union", torch_dtype=torch.bfloat16
78+
... )
6479
>>> controlnet = QwenImageMultiControlNetModel([controlnet])
65-
>>> pipe = QwenImageControlNetPipeline.from_pretrained("Qwen/Qwen-Image", controlnet=controlnet, torch_dtype=torch.bfloat16)
80+
>>> pipe = QwenImageControlNetPipeline.from_pretrained(
81+
... "Qwen/Qwen-Image", controlnet=controlnet, torch_dtype=torch.bfloat16
82+
... )
6683
>>> pipe.to("cuda")
6784
>>> prompt = "Aesthetics art, traditional asian pagoda, elaborate golden accents, sky blue and white color palette, swirling cloud pattern, digital illustration, east asian architecture, ornamental rooftop, intricate detailing on building, cultural representation."
6885
>>> negative_prompt = " "
69-
>>> control_image = load_image("https://huggingface.co/InstantX/Qwen-Image-ControlNet-Union/resolve/main/conds/canny.png")
86+
>>> control_image = load_image(
87+
... "https://huggingface.co/InstantX/Qwen-Image-ControlNet-Union/resolve/main/conds/canny.png"
88+
... )
7089
>>> # Depending on the variant being used, the pipeline call will slightly vary.
7190
>>> # Refer to the pipeline documentation for more details.
72-
>>> image = pipe(prompt, negative_prompt=negative_prompt, control_image=[control_image, control_image], controlnet_conditioning_scale=[0.5, 0.5], num_inference_steps=30, true_cfg_scale=4.0).images[0]
91+
>>> image = pipe(
92+
... prompt,
93+
... negative_prompt=negative_prompt,
94+
... control_image=[control_image, control_image],
95+
... controlnet_conditioning_scale=[0.5, 0.5],
96+
... num_inference_steps=30,
97+
... true_cfg_scale=4.0,
98+
... ).images[0]
7399
>>> image.save("qwenimage_cn_union_multi.png")
74100
```
75101
"""

0 commit comments

Comments
 (0)