forked from huggingface/optimum-intel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
29 lines (19 loc) · 1.1 KB
/
test.py
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
from optimum.intel import OVStableDiffusionPipeline
from optimum.intel import OVStableDiffusionContrlNetPipeline
from diffusers.training_utils import set_seed
from pathlib import Path
import numpy as np
import torch
from collections import namedtuple
import openvino as ov
from PIL import Image
import sys
from diffusers import UniPCMultistepScheduler
scheduler = UniPCMultistepScheduler.from_config("/home/chentianmeng/workspace/optimum-intel-controlnet/model/stable-diffusion-controlnet-openpose/scheduler/scheduler_config.json")
ov_pipe = OVStableDiffusionContrlNetPipeline.from_pretrained("/home/chentianmeng/workspace/optimum-intel-controlnet/model/stable-diffusion-controlnet-openpose", scheduler=scheduler,compile=False)
np.random.seed(42)
pose = Image.open(Path("/home/chentianmeng/workspace/optimum-intel-controlnet/pose.png"))
prompt = "Dancing Darth Vader, best quality, extremely detailed"
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
result = ov_pipe(prompt=prompt, image=pose, num_inference_steps=20, negative_prompt=negative_prompt)
result[0].save("pipeline_0.png")