File size: 795 Bytes
30d77d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import torch
from sdxl_unet2_trt import MyStableDiffusionXLPipeline
from PIL import Image

"""
With the current pipeline it just use to compare the Unet Diffusers vs Unet Onnx (calibrate)
Cannot get the result image  
"""

pipe = MyStableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float32
)
# pipe = pipe.to("cuda")

"""
For compare the Unet Diffusers vs Unet Onnx (calibrate)
"""
prompt = 'Portrait shot of a woman, yellow shirt, photograph'
image = pipe(prompt)

"""
Uncommand for get the result image
"""
# prompt = 'Portrait shot of a woman, yellow shirt, photograph'
# image = pipe(prompt).images[0]

# Save the image
# save_path = "/home/tiennv/trang/model_unet_quantize_full_onnx_2/image_sdxl_trt_b4.png"
# image.save(save_path)