Skip to content

Commit b79a92a

Browse files
committed
fix(qwen image):
- make fix-copies - update doc
1 parent 58ea3bf commit b79a92a

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/diffusers/pipelines/qwenimage/pipeline_qwenimage_edit.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@
4444
Examples:
4545
```py
4646
>>> import torch
47-
>>> from diffusers import QwenImagePipeline
47+
>>> from PIL import Image
48+
>>> from diffusers import QwenImageEditPipeline
4849
49-
>>> pipe = QwenImagePipeline.from_pretrained("Qwen/Qwen-Image", torch_dtype=torch.bfloat16)
50+
>>> pipe = QwenImageEditPipeline.from_pretrained("Qwen/Qwen-Image-Edit", torch_dtype=torch.bfloat16)
5051
>>> pipe.to("cuda")
51-
>>> prompt = "A cat holding a sign that says hello world"
52+
>>> prompt = "Change the cat to a dog"
53+
>>> image = Image.open("cat.png")
5254
>>> # Depending on the variant being used, the pipeline call will slightly vary.
5355
>>> # Refer to the pipeline documentation for more details.
54-
>>> image = pipe(prompt, num_inference_steps=50).images[0]
55-
>>> image.save("qwenimage.png")
56+
>>> image = pipe(image, prompt, num_inference_steps=50).images[0]
57+
>>> image.save("qwenimageedit.png")
5658
```
5759
"""
5860
PREFERRED_QWENIMAGE_RESOLUTIONS = [

src/diffusers/utils/dummy_torch_and_transformers_objects.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,21 @@ def from_pretrained(cls, *args, **kwargs):
17421742
requires_backends(cls, ["torch", "transformers"])
17431743

17441744

1745+
class QwenImageEditPipeline(metaclass=DummyObject):
1746+
_backends = ["torch", "transformers"]
1747+
1748+
def __init__(self, *args, **kwargs):
1749+
requires_backends(self, ["torch", "transformers"])
1750+
1751+
@classmethod
1752+
def from_config(cls, *args, **kwargs):
1753+
requires_backends(cls, ["torch", "transformers"])
1754+
1755+
@classmethod
1756+
def from_pretrained(cls, *args, **kwargs):
1757+
requires_backends(cls, ["torch", "transformers"])
1758+
1759+
17451760
class QwenImageImg2ImgPipeline(metaclass=DummyObject):
17461761
_backends = ["torch", "transformers"]
17471762

0 commit comments

Comments
 (0)