Spaces:
Running
on
Zero
Running
on
Zero
Update pipeline_stable_diffusion_3_ipa.py
Browse files
pipeline_stable_diffusion_3_ipa.py
CHANGED
|
@@ -1204,15 +1204,13 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
| 1204 |
#clip_image_embeds = torch.cat([torch.zeros_like(torch.stack(image_prompt_embeds_list)), torch.stack(image_prompt_embeds_list)], dim=0).mean(dim=0)
|
| 1205 |
# FAILS clip_image_embeds = torch.cat(torch.stack(image_prompt_embeds_list), dim=0).mean(dim=0)
|
| 1206 |
# FAILS TIMESTEPS clip_image_embeds = torch.cat(image_prompt_embeds_list, dim=0).mean(dim=0)
|
| 1207 |
-
clip_image_embeds_cat_list = torch.cat(image_prompt_embeds_list).mean(dim=0)
|
| 1208 |
-
print('catted with mean shape 1: ', clip_image_embeds_cat_list.shape)
|
| 1209 |
-
clip_image_embeds_stack_list = torch.stack(image_prompt_embeds_list).mean(dim=0)
|
| 1210 |
-
print('stacked with mean shape 1: ', clip_image_embeds_stack_list.shape)
|
| 1211 |
-
clip_image_embeds_cat_list = torch.cat(image_prompt_embeds_list)
|
| 1212 |
-
print('catted without mean shape 1: ', clip_image_embeds_cat_list.shape)
|
| 1213 |
-
clip_image_embeds_stack_list = torch.stack(image_prompt_embeds_list)
|
| 1214 |
-
print('stacked without mean shape 1: ', clip_image_embeds_stack_list.shape)
|
| 1215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1216 |
|
| 1217 |
# 1. Stack the image embeddings
|
| 1218 |
stacked_image_embeds = torch.cat(image_prompt_embeds_list, dim=1)
|
|
@@ -1236,7 +1234,7 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
| 1236 |
print('shape 4a: ', clip_image_embeds_repeat_cat.shape)
|
| 1237 |
clip_image_embeds_repeat_cat_1 = torch.cat([zeros_tensor_repeat, clip_image_embeds_repeat], dim=1)
|
| 1238 |
print('shape 4b: ', clip_image_embeds_repeat_cat_1.shape)
|
| 1239 |
-
clip_image_embeds = clip_image_embeds_repeat_cat
|
| 1240 |
'''
|
| 1241 |
#clip_image_embeds = clip_image_embeds.unsqueeze(0) # Add a dimension at the beginning so now you have [1, 2*seq_len_img, embed_dim_img]
|
| 1242 |
print('shape 5: ', clip_image_embeds.shape)
|
|
|
|
| 1204 |
#clip_image_embeds = torch.cat([torch.zeros_like(torch.stack(image_prompt_embeds_list)), torch.stack(image_prompt_embeds_list)], dim=0).mean(dim=0)
|
| 1205 |
# FAILS clip_image_embeds = torch.cat(torch.stack(image_prompt_embeds_list), dim=0).mean(dim=0)
|
| 1206 |
# FAILS TIMESTEPS clip_image_embeds = torch.cat(image_prompt_embeds_list, dim=0).mean(dim=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1207 |
|
| 1208 |
+
clip_image_embeds_stack_list = torch.stack(image_prompt_embeds_list).mean(dim=0)
|
| 1209 |
+
print('stacked with mean dim 0 shape: ', clip_image_embeds_stack_list.shape)
|
| 1210 |
+
zeroes_tensor = torch.zeros_like(clip_image_embeds_stack_list)
|
| 1211 |
+
print('zeros shape: ', stacked_image_embeds.shape)
|
| 1212 |
+
clip_image_embeds = torch.cat([zeroes_tensor, clip_image_embeds_stack_list], dim=0)
|
| 1213 |
+
print('embeds shape: ', clip_image_embeds.shape)
|
| 1214 |
|
| 1215 |
# 1. Stack the image embeddings
|
| 1216 |
stacked_image_embeds = torch.cat(image_prompt_embeds_list, dim=1)
|
|
|
|
| 1234 |
print('shape 4a: ', clip_image_embeds_repeat_cat.shape)
|
| 1235 |
clip_image_embeds_repeat_cat_1 = torch.cat([zeros_tensor_repeat, clip_image_embeds_repeat], dim=1)
|
| 1236 |
print('shape 4b: ', clip_image_embeds_repeat_cat_1.shape)
|
| 1237 |
+
#clip_image_embeds = clip_image_embeds_repeat_cat
|
| 1238 |
'''
|
| 1239 |
#clip_image_embeds = clip_image_embeds.unsqueeze(0) # Add a dimension at the beginning so now you have [1, 2*seq_len_img, embed_dim_img]
|
| 1240 |
print('shape 5: ', clip_image_embeds.shape)
|