Spaces:
Running
on
Zero
Running
on
Zero
1inkusFace
commited on
Update pipeline_stable_diffusion_3_ipa.py
Browse files
pipeline_stable_diffusion_3_ipa.py
CHANGED
@@ -1193,19 +1193,13 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
1193 |
clip_image_embeds_5 = clip_image_embeds_5 * scale_5
|
1194 |
image_prompt_embeds_list.append(clip_image_embeds_5)
|
1195 |
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
#clip_image_embeds_view = clip_image_embeds_view.view(1, seq_len, -1)
|
1204 |
-
#print('catted viewed: ',clip_image_embeds_view.shape)
|
1205 |
-
zeros_tensor = torch.zeros_like(clip_image_embeds_view)
|
1206 |
-
#zeros_tensor = torch.zeros_like(clip_image_embeds_view[:, :image_prompt_embeds_list[0].shape[1], :]) # Make zeros tensor match the sequence length of a single image embedding
|
1207 |
-
print('zeros shape: ',zeros_tensor.shape)
|
1208 |
-
clip_image_embeds = torch.cat([zeros_tensor, clip_image_embeds_view], dim=0)
|
1209 |
print('embeds shape: ', clip_image_embeds.shape)
|
1210 |
|
1211 |
# 4. Prepare timesteps
|
|
|
1193 |
clip_image_embeds_5 = clip_image_embeds_5 * scale_5
|
1194 |
image_prompt_embeds_list.append(clip_image_embeds_5)
|
1195 |
|
1196 |
+
clip_image_embeds_cat = torch.cat(image_prompt_embeds_list, dim=0)
|
1197 |
+
clip_image_embeds_mean = clip_image_embeds_cat.mean(dim=0, keepdim=True)
|
1198 |
+
#clip_image_embeds_cat_list = torch.cat(image_prompt_embeds_list).mean(dim=1,keepdim=True)
|
1199 |
+
print('catted embeds list with mean: ', clip_image_embeds_mean.shape)
|
1200 |
+
zeros_tensor = torch.zeros_like(clip_image_embeds_mean)
|
1201 |
+
print('zeros: ',zeros_tensor.shape)
|
1202 |
+
clip_image_embeds = torch.cat([zeros_tensor, clip_image_embeds_mean], dim=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
1203 |
print('embeds shape: ', clip_image_embeds.shape)
|
1204 |
|
1205 |
# 4. Prepare timesteps
|