Skip to content

Commit f506704

Browse files
committed
Merge branch 'main' into automodel-custom-model
2 parents 8f63b4b + 843355f commit f506704

14 files changed

+947
-9
lines changed

examples/server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ This guide will show you how to use the [`StableDiffusion3Pipeline`] in a server
99
Start by navigating to the `examples/server` folder and installing all of the dependencies.
1010

1111
```py
12-
pip install .
13-
pip install -f requirements.txt
12+
pip install diffusers
13+
pip install -r requirements.txt
1414
```
1515

1616
Launch the server with the following command.

examples/server/requirements.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ py-consul
66
prometheus_client >= 0.18.0
77
prometheus-fastapi-instrumentator >= 7.0.0
88
fastapi
9-
uvicorn
9+
uvicorn
10+
accelerate

examples/server/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fsspec==2024.10.0
3939
# torch
4040
h11==0.14.0
4141
# via uvicorn
42-
huggingface-hub==0.26.1
42+
huggingface-hub==0.35.0
4343
# via
4444
# tokenizers
4545
# transformers

src/diffusers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@
515515
"QwenImageControlNetPipeline",
516516
"QwenImageEditInpaintPipeline",
517517
"QwenImageEditPipeline",
518+
"QwenImageEditPlusPipeline",
518519
"QwenImageImg2ImgPipeline",
519520
"QwenImageInpaintPipeline",
520521
"QwenImagePipeline",
@@ -1170,6 +1171,7 @@
11701171
QwenImageControlNetPipeline,
11711172
QwenImageEditInpaintPipeline,
11721173
QwenImageEditPipeline,
1174+
QwenImageEditPlusPipeline,
11731175
QwenImageImg2ImgPipeline,
11741176
QwenImageInpaintPipeline,
11751177
QwenImagePipeline,

src/diffusers/pipelines/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@
394394
"QwenImageImg2ImgPipeline",
395395
"QwenImageInpaintPipeline",
396396
"QwenImageEditPipeline",
397+
"QwenImageEditPlusPipeline",
397398
"QwenImageEditInpaintPipeline",
398399
"QwenImageControlNetInpaintPipeline",
399400
"QwenImageControlNetPipeline",
@@ -721,6 +722,7 @@
721722
QwenImageControlNetPipeline,
722723
QwenImageEditInpaintPipeline,
723724
QwenImageEditPipeline,
725+
QwenImageEditPlusPipeline,
724726
QwenImageImg2ImgPipeline,
725727
QwenImageInpaintPipeline,
726728
QwenImagePipeline,

src/diffusers/pipelines/pipeline_loading_utils.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@
4848
if is_transformers_available():
4949
import transformers
5050
from transformers import PreTrainedModel, PreTrainedTokenizerBase
51-
from transformers.utils import FLAX_WEIGHTS_NAME as TRANSFORMERS_FLAX_WEIGHTS_NAME
5251
from transformers.utils import SAFE_WEIGHTS_NAME as TRANSFORMERS_SAFE_WEIGHTS_NAME
5352
from transformers.utils import WEIGHTS_NAME as TRANSFORMERS_WEIGHTS_NAME
5453

54+
if is_transformers_version("<=", "4.56.2"):
55+
from transformers.utils import FLAX_WEIGHTS_NAME as TRANSFORMERS_FLAX_WEIGHTS_NAME
56+
5557
if is_accelerate_available():
5658
import accelerate
5759
from accelerate import dispatch_model
@@ -112,7 +114,9 @@ def is_safetensors_compatible(filenames, passed_components=None, folder_names=No
112114
]
113115

114116
if is_transformers_available():
115-
weight_names += [TRANSFORMERS_WEIGHTS_NAME, TRANSFORMERS_SAFE_WEIGHTS_NAME, TRANSFORMERS_FLAX_WEIGHTS_NAME]
117+
weight_names += [TRANSFORMERS_WEIGHTS_NAME, TRANSFORMERS_SAFE_WEIGHTS_NAME]
118+
if is_transformers_version("<=", "4.56.2"):
119+
weight_names += [TRANSFORMERS_FLAX_WEIGHTS_NAME]
116120

117121
# model_pytorch, diffusion_model_pytorch, ...
118122
weight_prefixes = [w.split(".")[0] for w in weight_names]
@@ -191,7 +195,9 @@ def filter_model_files(filenames):
191195
]
192196

193197
if is_transformers_available():
194-
weight_names += [TRANSFORMERS_WEIGHTS_NAME, TRANSFORMERS_SAFE_WEIGHTS_NAME, TRANSFORMERS_FLAX_WEIGHTS_NAME]
198+
weight_names += [TRANSFORMERS_WEIGHTS_NAME, TRANSFORMERS_SAFE_WEIGHTS_NAME]
199+
if is_transformers_version("<=", "4.56.2"):
200+
weight_names += [TRANSFORMERS_FLAX_WEIGHTS_NAME]
195201

196202
allowed_extensions = [wn.split(".")[-1] for wn in weight_names]
197203

@@ -212,7 +218,9 @@ def variant_compatible_siblings(filenames, variant=None, ignore_patterns=None) -
212218
]
213219

214220
if is_transformers_available():
215-
weight_names += [TRANSFORMERS_WEIGHTS_NAME, TRANSFORMERS_SAFE_WEIGHTS_NAME, TRANSFORMERS_FLAX_WEIGHTS_NAME]
221+
weight_names += [TRANSFORMERS_WEIGHTS_NAME, TRANSFORMERS_SAFE_WEIGHTS_NAME]
222+
if is_transformers_version("<=", "4.56.2"):
223+
weight_names += [TRANSFORMERS_FLAX_WEIGHTS_NAME]
216224

217225
# model_pytorch, diffusion_model_pytorch, ...
218226
weight_prefixes = [w.split(".")[0] for w in weight_names]

src/diffusers/pipelines/qwenimage/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
_import_structure["pipeline_qwenimage_controlnet_inpaint"] = ["QwenImageControlNetInpaintPipeline"]
2929
_import_structure["pipeline_qwenimage_edit"] = ["QwenImageEditPipeline"]
3030
_import_structure["pipeline_qwenimage_edit_inpaint"] = ["QwenImageEditInpaintPipeline"]
31+
_import_structure["pipeline_qwenimage_edit_plus"] = ["QwenImageEditPlusPipeline"]
3132
_import_structure["pipeline_qwenimage_img2img"] = ["QwenImageImg2ImgPipeline"]
3233
_import_structure["pipeline_qwenimage_inpaint"] = ["QwenImageInpaintPipeline"]
3334

@@ -43,6 +44,7 @@
4344
from .pipeline_qwenimage_controlnet_inpaint import QwenImageControlNetInpaintPipeline
4445
from .pipeline_qwenimage_edit import QwenImageEditPipeline
4546
from .pipeline_qwenimage_edit_inpaint import QwenImageEditInpaintPipeline
47+
from .pipeline_qwenimage_edit_plus import QwenImageEditPlusPipeline
4648
from .pipeline_qwenimage_img2img import QwenImageImg2ImgPipeline
4749
from .pipeline_qwenimage_inpaint import QwenImageInpaintPipeline
4850
else:

src/diffusers/pipelines/qwenimage/pipeline_qwenimage_edit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def __init__(
208208
# QwenImage latents are turned into 2x2 patches and packed. This means the latent width and height has to be divisible
209209
# by the patch size. So the vae scale factor is multiplied by the patch size to account for this
210210
self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor * 2)
211-
self.vl_processor = processor
212211
self.tokenizer_max_length = 1024
213212

214213
self.prompt_template_encode = "<|im_start|>system\nDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.<|im_end|>\n<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|>{}<|im_end|>\n<|im_start|>assistant\n"

0 commit comments

Comments
 (0)