Update pipeline_stable_diffusion_3_ipa.py
Browse files
pipeline_stable_diffusion_3_ipa.py
CHANGED
@@ -1164,7 +1164,6 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
1164 |
clip_image_embeds_2 = clip_image_embeds_2.to(device, dtype=dtype)
|
1165 |
clip_image_embeds_2 = self.image_encoder(clip_image_embeds_2, output_hidden_states=True).hidden_states[-2]
|
1166 |
clip_image_embeds_2 = clip_image_embeds_2 * scale_2
|
1167 |
-
print('encoder output size 2: ', clip_image_embeds_2.shape)
|
1168 |
image_prompt_embeds_list.append(clip_image_embeds_2)
|
1169 |
if clip_image_3 != None:
|
1170 |
print('Using tertiary image.')
|
@@ -1174,7 +1173,6 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
1174 |
clip_image_embeds_3 = clip_image_embeds_3.to(device, dtype=dtype)
|
1175 |
clip_image_embeds_3 = self.image_encoder(clip_image_embeds_3, output_hidden_states=True).hidden_states[-2]
|
1176 |
clip_image_embeds_3 = clip_image_embeds_3 * scale_3
|
1177 |
-
print('encoder output size 3: ', clip_image_embeds_3.shape)
|
1178 |
image_prompt_embeds_list.append(clip_image_embeds_3)
|
1179 |
if clip_image_4 != None:
|
1180 |
print('Using quaternary image.')
|
@@ -1182,9 +1180,8 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
1182 |
with torch.inference_mode():
|
1183 |
clip_image_embeds_4 = self.clip_image_processor(images=clip_image_4, return_tensors="pt").pixel_values
|
1184 |
clip_image_embeds_4 = clip_image_embeds_4.to(device, dtype=dtype)
|
1185 |
-
|
1186 |
clip_image_embeds_4 = clip_image_embeds_4 * scale_4
|
1187 |
-
print('encoder output size 4: ', clip_image_embeds_4.shape)
|
1188 |
image_prompt_embeds_list.append(clip_image_embeds_4)
|
1189 |
if clip_image_5 != None:
|
1190 |
print('Using quinary image.')
|
@@ -1194,7 +1191,6 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
1194 |
clip_image_embeds_5 = clip_image_embeds_5.to(device, dtype=dtype)
|
1195 |
clip_image_embeds_5 = self.image_encoder(clip_image_embeds_5, output_hidden_states=True).hidden_states[-2]
|
1196 |
clip_image_embeds_5 = clip_image_embeds_5 * scale_5
|
1197 |
-
print('encoder output size 5: ', clip_image_embeds_5.shape)
|
1198 |
image_prompt_embeds_list.append(clip_image_embeds_5)
|
1199 |
|
1200 |
clip_image_embeds_cat_list = torch.cat(image_prompt_embeds_list).mean(dim=0)
|
|
|
1164 |
clip_image_embeds_2 = clip_image_embeds_2.to(device, dtype=dtype)
|
1165 |
clip_image_embeds_2 = self.image_encoder(clip_image_embeds_2, output_hidden_states=True).hidden_states[-2]
|
1166 |
clip_image_embeds_2 = clip_image_embeds_2 * scale_2
|
|
|
1167 |
image_prompt_embeds_list.append(clip_image_embeds_2)
|
1168 |
if clip_image_3 != None:
|
1169 |
print('Using tertiary image.')
|
|
|
1173 |
clip_image_embeds_3 = clip_image_embeds_3.to(device, dtype=dtype)
|
1174 |
clip_image_embeds_3 = self.image_encoder(clip_image_embeds_3, output_hidden_states=True).hidden_states[-2]
|
1175 |
clip_image_embeds_3 = clip_image_embeds_3 * scale_3
|
|
|
1176 |
image_prompt_embeds_list.append(clip_image_embeds_3)
|
1177 |
if clip_image_4 != None:
|
1178 |
print('Using quaternary image.')
|
|
|
1180 |
with torch.inference_mode():
|
1181 |
clip_image_embeds_4 = self.clip_image_processor(images=clip_image_4, return_tensors="pt").pixel_values
|
1182 |
clip_image_embeds_4 = clip_image_embeds_4.to(device, dtype=dtype)
|
1183 |
+
clip_image_embeds_4 = self.image_encoder(clip_image_embeds_4, output_hidden_states=True).hidden_states[-2]
|
1184 |
clip_image_embeds_4 = clip_image_embeds_4 * scale_4
|
|
|
1185 |
image_prompt_embeds_list.append(clip_image_embeds_4)
|
1186 |
if clip_image_5 != None:
|
1187 |
print('Using quinary image.')
|
|
|
1191 |
clip_image_embeds_5 = clip_image_embeds_5.to(device, dtype=dtype)
|
1192 |
clip_image_embeds_5 = self.image_encoder(clip_image_embeds_5, output_hidden_states=True).hidden_states[-2]
|
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_list = torch.cat(image_prompt_embeds_list).mean(dim=0)
|