pengdaqian commited on
Commit
8e198ad
1 Parent(s): 7609f72
Files changed (2) hide show
  1. model.py +28 -8
  2. requirements.txt +1 -2
model.py CHANGED
@@ -3,7 +3,6 @@ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler, DPMSolver
3
  OnnxStableDiffusionPipeline
4
 
5
  import pipeline_openvino_stable_diffusion
6
- from optimum.intel.openvino import OVStableDiffusionPipeline
7
 
8
 
9
  def get_sd_21():
@@ -31,19 +30,40 @@ def get_sd_21():
31
  def get_sd_every():
32
  model_id = 'OFA-Sys/small-stable-diffusion-v0'
33
  scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="scheduler")
34
- pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/stable-diffusion-2-1-quantized", compile=False)
 
 
 
 
 
 
 
35
  return pipe
36
 
37
 
38
  def get_sd_small():
39
- pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/stable-diffusion-2-1-quantized", compile=False)
40
- pipe.reshape(batch_size=1, height=256, width=256, num_images_per_prompt=1)
41
- pipe.compile()
 
 
 
 
 
 
 
42
  return pipe
43
 
44
 
45
  def get_sd_tiny():
46
- pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/stable-diffusion-2-1-quantized", compile=False)
47
- pipe.reshape(batch_size=1, height=512, width=512, num_images_per_prompt=1)
48
- pipe.compile()
 
 
 
 
 
 
 
49
  return pipe
 
3
  OnnxStableDiffusionPipeline
4
 
5
  import pipeline_openvino_stable_diffusion
 
6
 
7
 
8
  def get_sd_21():
 
30
  def get_sd_every():
31
  model_id = 'OFA-Sys/small-stable-diffusion-v0'
32
  scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="scheduler")
33
+
34
+ onnx_pipe = OnnxStableDiffusionPipeline.from_pretrained(
35
+ "OFA-Sys/small-stable-diffusion-v0",
36
+ scheduler=scheduler,
37
+ revision="onnx",
38
+ provider="CPUExecutionProvider",
39
+ )
40
+ pipe = pipeline_openvino_stable_diffusion.OpenVINOStableDiffusionPipeline.from_onnx_pipeline(onnx_pipe)
41
  return pipe
42
 
43
 
44
  def get_sd_small():
45
+ model_id = 'OFA-Sys/small-stable-diffusion-v0'
46
+ scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="scheduler")
47
+
48
+ onnx_pipe = OnnxStableDiffusionPipeline.from_pretrained(
49
+ "OFA-Sys/small-stable-diffusion-v0",
50
+ scheduler=scheduler,
51
+ revision="onnx",
52
+ provider="CPUExecutionProvider",
53
+ )
54
+ pipe = pipeline_openvino_stable_diffusion.OpenVINOStableDiffusionPipeline.from_onnx_pipeline(onnx_pipe)
55
  return pipe
56
 
57
 
58
  def get_sd_tiny():
59
+ model_id = 'OFA-Sys/small-stable-diffusion-v0'
60
+ scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="scheduler")
61
+
62
+ onnx_pipe = OnnxStableDiffusionPipeline.from_pretrained(
63
+ "OFA-Sys/small-stable-diffusion-v0",
64
+ scheduler=scheduler,
65
+ revision="onnx",
66
+ provider="CPUExecutionProvider",
67
+ )
68
+ pipe = pipeline_openvino_stable_diffusion.OpenVINOStableDiffusionPipeline.from_onnx_pipeline(onnx_pipe)
69
  return pipe
requirements.txt CHANGED
@@ -8,5 +8,4 @@ onnx
8
  openvino
9
  onnxruntime-openvino
10
  ftfy
11
- py-cpuinfo
12
- optimum-intel[openvino, diffusers]
 
8
  openvino
9
  onnxruntime-openvino
10
  ftfy
11
+ py-cpuinfo