poipiii commited on
Commit
46b8b78
1 Parent(s): 64e0ab0

fix interpolation size

Browse files
Files changed (1) hide show
  1. pipeline.py +22 -20
pipeline.py CHANGED
@@ -1185,23 +1185,25 @@ class StableDiffusionLongPromptWeightingPipeline(StableDiffusionPipeline):
1185
  callback_steps=callback_steps,
1186
  )
1187
  image_tensor = torch.from_numpy(image.images[0])
1188
-
1189
- # resized_image = torch.nn.functional.interpolate(
1190
- # image_tensor, size=(int(height*resize_scale), int(width*resize_scale)))
1191
-
1192
- # highres_image = self.__call__(prompt=prompt,
1193
- # negative_prompt=negative_prompt,
1194
- # image=resized_image,
1195
- # num_inference_steps=num_inference_steps_upscale,
1196
- # guidance_scale=guidance_scale,
1197
- # strength=strength,
1198
- # num_images_per_prompt=num_images_per_prompt,
1199
- # eta=eta,
1200
- # generator=generator,
1201
- # max_embeddings_multiples=max_embeddings_multiples,
1202
- # output_type=output_type,
1203
- # return_dict=return_dict,
1204
- # callback=callback,
1205
- # is_cancelled_callback=is_cancelled_callback,
1206
- # callback_steps=callback_steps,)
1207
- return image
 
 
 
1185
  callback_steps=callback_steps,
1186
  )
1187
  image_tensor = torch.from_numpy(image.images[0])
1188
+ image_tensor = torch.unsqueeze(
1189
+ image_tensor.reshape([3, height, width]), 0)
1190
+
1191
+ resized_image = torch.nn.functional.interpolate(
1192
+ image_tensor, size=(int(height*resize_scale), int(width*resize_scale)))
1193
+
1194
+ highres_image = self.__call__(prompt=prompt,
1195
+ negative_prompt=negative_prompt,
1196
+ image=resized_image,
1197
+ num_inference_steps=num_inference_steps_upscale,
1198
+ guidance_scale=guidance_scale,
1199
+ strength=strength,
1200
+ num_images_per_prompt=num_images_per_prompt,
1201
+ eta=eta,
1202
+ generator=generator,
1203
+ max_embeddings_multiples=max_embeddings_multiples,
1204
+ output_type=output_type,
1205
+ return_dict=return_dict,
1206
+ callback=callback,
1207
+ is_cancelled_callback=is_cancelled_callback,
1208
+ callback_steps=callback_steps,)
1209
+ return highres_image