File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
shark/examples/shark_inference/stable_diffusion Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 55from transformers import CLIPTextModel , CLIPTokenizer
66import torch
77from PIL import Image
8- import torchvision .transforms as T
98from diffusers import (
109 LMSDiscreteScheduler ,
1110 PNDMScheduler ,
@@ -272,11 +271,8 @@ def end_profiling(device):
272271 print (f"VAE Inference time (ms): { vae_inf_time :.3f} " )
273272 print (f"\n Total image generation time: { total_time } sec" )
274273
275- transform = T .ToPILImage ()
276- pil_images = [
277- transform (image )
278- for image in torch .from_numpy (images ).to (torch .uint8 )
279- ]
274+ images = torch .from_numpy (images ).to (torch .uint8 ).permute (0 , 2 , 3 , 1 )
275+ pil_images = [Image .fromarray (image ) for image in images .numpy ()]
280276
281277 if args .output_dir is not None :
282278 output_path = Path (args .output_dir )
You can’t perform that action at this time.
0 commit comments