Skip to content

Commit 81ed52f

Browse files
committed
fix
1 parent f50b18e commit 81ed52f

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

src/diffusers/modular_pipelines/qwenimage/before_denoise.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,8 @@ def description(self) -> str:
577577
def inputs(self) -> List[InputParam]:
578578
return [
579579
InputParam(name="batch_size", required=True),
580-
InputParam(
581-
name="resized_image", required=True, type_hint=torch.Tensor, description="The resized image input"
582-
),
580+
InputParam(name="image_height", required=True),
581+
InputParam(name="image_width", required=True),
583582
InputParam(name="height", required=True),
584583
InputParam(name="width", required=True),
585584
InputParam(name="prompt_embeds_mask"),
@@ -612,10 +611,7 @@ def __call__(self, components: QwenImageModularPipeline, state: PipelineState) -
612611
block_state = self.get_block_state(state)
613612

614613
# for edit, image size can be different from the target size (height/width)
615-
image = (
616-
block_state.resized_image[0] if isinstance(block_state.resized_image, list) else block_state.resized_image
617-
)
618-
image_width, image_height = image.size
614+
619615

620616
block_state.img_shapes = [
621617
[
@@ -624,7 +620,7 @@ def __call__(self, components: QwenImageModularPipeline, state: PipelineState) -
624620
block_state.height // components.vae_scale_factor // 2,
625621
block_state.width // components.vae_scale_factor // 2,
626622
),
627-
(1, image_height // components.vae_scale_factor // 2, image_width // components.vae_scale_factor // 2),
623+
(1, block_state.image_height // components.vae_scale_factor // 2, block_state.image_width // components.vae_scale_factor // 2),
628624
]
629625
] * block_state.batch_size
630626

src/diffusers/modular_pipelines/qwenimage/encoders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def __call__(self, components: QwenImageModularPipeline, state: PipelineState):
496496
)
497497

498498
if components.requires_unconditional_embeds:
499-
negative_prompt = block_state.negative_prompt or ""
499+
negative_prompt = block_state.negative_prompt or " "
500500
block_state.negative_prompt_embeds, block_state.negative_prompt_embeds_mask = get_qwen_prompt_embeds_edit(
501501
components.text_encoder,
502502
components.processor,

src/diffusers/modular_pipelines/qwenimage/inputs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ def inputs(self) -> List[InputParam]:
307307

308308
return inputs
309309

310+
@property
311+
def intermediate_outputs(self) -> List[OutputParam]:
312+
return [
313+
OutputParam(name="image_height", type_hint=int, description="The height of the image latents"),
314+
OutputParam(name="image_width", type_hint=int, description="The width of the image latents"),
315+
]
316+
310317
@property
311318
def expected_components(self) -> List[ComponentSpec]:
312319
return [
@@ -327,6 +334,11 @@ def __call__(self, components: QwenImageModularPipeline, state: PipelineState) -
327334
block_state.height = block_state.height or height
328335
block_state.width = block_state.width or width
329336

337+
if not hasattr(block_state, "image_height"):
338+
block_state.image_height = height
339+
if not hasattr(block_state, "image_width"):
340+
block_state.image_width = width
341+
330342
# 2. Patchify the image latent tensor
331343
image_latent_tensor = components.pachifier.pack_latents(image_latent_tensor)
332344

src/diffusers/modular_pipelines/qwenimage/modular_blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def description(self):
699699
class QwenImageEditAutoInputStep(AutoPipelineBlocks):
700700
block_classes = [QwenImageInpaintInputStep, QwenImageEditInputStep]
701701
block_names = ["edit_inpaint", "edit"]
702-
block_trigger_inputs = ["processed_mask_image", "image"]
702+
block_trigger_inputs = ["processed_mask_image", "image_latents"]
703703

704704
@property
705705
def description(self):

src/diffusers/modular_pipelines/stable_diffusion_xl/modular_blocks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class StableDiffusionXLAutoBlocks(SequentialPipelineBlocks):
269269
block_names = [
270270
"text_encoder",
271271
"ip_adapter",
272-
"image_encoder",
272+
"vae_encoder",
273273
"before_denoise",
274274
"controlnet_input",
275275
"denoise",
@@ -321,7 +321,7 @@ def description(self):
321321
IMAGE2IMAGE_BLOCKS = InsertableDict(
322322
[
323323
("text_encoder", StableDiffusionXLTextEncoderStep),
324-
("image_encoder", StableDiffusionXLVaeEncoderStep),
324+
("vae_encoder", StableDiffusionXLVaeEncoderStep),
325325
("input", StableDiffusionXLInputStep),
326326
("set_timesteps", StableDiffusionXLImg2ImgSetTimestepsStep),
327327
("prepare_latents", StableDiffusionXLImg2ImgPrepareLatentsStep),
@@ -334,7 +334,7 @@ def description(self):
334334
INPAINT_BLOCKS = InsertableDict(
335335
[
336336
("text_encoder", StableDiffusionXLTextEncoderStep),
337-
("image_encoder", StableDiffusionXLInpaintVaeEncoderStep),
337+
("vae_encoder", StableDiffusionXLInpaintVaeEncoderStep),
338338
("input", StableDiffusionXLInputStep),
339339
("set_timesteps", StableDiffusionXLImg2ImgSetTimestepsStep),
340340
("prepare_latents", StableDiffusionXLInpaintPrepareLatentsStep),
@@ -361,7 +361,7 @@ def description(self):
361361
[
362362
("text_encoder", StableDiffusionXLTextEncoderStep),
363363
("ip_adapter", StableDiffusionXLAutoIPAdapterStep),
364-
("image_encoder", StableDiffusionXLAutoVaeEncoderStep),
364+
("vae_encoder", StableDiffusionXLAutoVaeEncoderStep),
365365
("before_denoise", StableDiffusionXLAutoBeforeDenoiseStep),
366366
("controlnet_input", StableDiffusionXLAutoControlNetInputStep),
367367
("denoise", StableDiffusionXLAutoDenoiseStep),

0 commit comments

Comments
 (0)