helenai's picture
commit files to HF hub
32e03f8
raw
history blame contribute delete
693 Bytes
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/CompVis-stable-diffusion-v1-4-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")