Skip to content

Commit a0a5427

Browse files
Dalankeyiyixuxuyiyixuxu
committed
[SD3] Fix mis-matched shape when num_images_per_prompt > 1 using without T5 (text_encoder_3=None) (#8558)
* fix shape mismatch when num_images_per_prompt > 1 and text_encoder_3=None * style * fix copies --------- Co-authored-by: YiYi Xu <yixu310@gmail.com> Co-authored-by: yiyixuxu <yixu310@gmail,com>
1 parent dc74c7e commit a0a5427

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ def _get_t5_prompt_embeds(
217217

218218
if self.text_encoder_3 is None:
219219
return torch.zeros(
220-
(batch_size, self.tokenizer_max_length, self.transformer.config.joint_attention_dim),
220+
(
221+
batch_size * num_images_per_prompt,
222+
self.tokenizer_max_length,
223+
self.transformer.config.joint_attention_dim,
224+
),
221225
device=device,
222226
dtype=dtype,
223227
)

src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ def _get_t5_prompt_embeds(
232232

233233
if self.text_encoder_3 is None:
234234
return torch.zeros(
235-
(batch_size, self.tokenizer_max_length, self.transformer.config.joint_attention_dim),
235+
(
236+
batch_size * num_images_per_prompt,
237+
self.tokenizer_max_length,
238+
self.transformer.config.joint_attention_dim,
239+
),
236240
device=device,
237241
dtype=dtype,
238242
)

0 commit comments

Comments
 (0)