File size: 695 Bytes
dc80f39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from optimum.intel.openvino.modeling_diffusion import OVStableDiffusionPipeline

batch_size = 1
num_images_per_prompt = 1
height = 256
width = 256

# load the model and reshape to static shapes for faster inference
model_id = "helenai/lambdalabs-sd-pokemon-diffusers-ov"
stable_diffusion = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False)
stable_diffusion.reshape( batch_size=batch_size, height=height, width=width, num_images_per_prompt=num_images_per_prompt)
stable_diffusion.compile()

# generate image!
prompt = "a random image"
images = stable_diffusion(prompt, height=height, width=width, num_images_per_prompt=num_images_per_prompt).images
images[0].save("result.png")