pengdaqian commited on
Commit
8c80b14
1 Parent(s): a09e623
Files changed (3) hide show
  1. app.py +1 -1
  2. model.py +2 -4
  3. pipeline_openvino_stable_diffusion.py +1 -2
app.py CHANGED
@@ -12,7 +12,7 @@ from i18n import i18nTranslator
12
  word_list_dataset = load_dataset("Gustavosta/Stable-Diffusion-Prompts")
13
  word_list = word_list_dataset["train"]['Prompt']
14
 
15
- from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler, DDIMScheduler, KDPM2AncestralDiscreteScheduler, \
16
  UniPCMultistepScheduler, DPMSolverSinglestepScheduler, DEISMultistepScheduler, PNDMScheduler, \
17
  DPMSolverMultistepScheduler, HeunDiscreteScheduler, EulerAncestralDiscreteScheduler, DDPMScheduler, \
18
  LMSDiscreteScheduler, KDPM2DiscreteScheduler
 
12
  word_list_dataset = load_dataset("Gustavosta/Stable-Diffusion-Prompts")
13
  word_list = word_list_dataset["train"]['Prompt']
14
 
15
+ from diffusers import EulerDiscreteScheduler, DDIMScheduler, KDPM2AncestralDiscreteScheduler, \
16
  UniPCMultistepScheduler, DPMSolverSinglestepScheduler, DEISMultistepScheduler, PNDMScheduler, \
17
  DPMSolverMultistepScheduler, HeunDiscreteScheduler, EulerAncestralDiscreteScheduler, DDPMScheduler, \
18
  LMSDiscreteScheduler, KDPM2DiscreteScheduler
model.py CHANGED
@@ -32,13 +32,11 @@ def get_sd_small():
32
  model_id = 'OFA-Sys/small-stable-diffusion-v0'
33
  scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="scheduler")
34
 
35
- onnx_pipe = OnnxStableDiffusionPipeline.from_pretrained(
36
  "OFA-Sys/small-stable-diffusion-v0",
37
  scheduler=scheduler,
38
- revision="onnx",
39
- provider="CPUExecutionProvider",
40
  )
41
- pipe = pipeline_openvino_stable_diffusion.OpenVINOStableDiffusionPipeline.from_onnx_pipeline(onnx_pipe)
42
  return pipe
43
 
44
 
 
32
  model_id = 'OFA-Sys/small-stable-diffusion-v0'
33
  scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="scheduler")
34
 
35
+ pipe = OVStableDiffusionPipeline.from_pretrained(
36
  "OFA-Sys/small-stable-diffusion-v0",
37
  scheduler=scheduler,
 
 
38
  )
39
+ pipe.compile()
40
  return pipe
41
 
42
 
pipeline_openvino_stable_diffusion.py CHANGED
@@ -159,8 +159,7 @@ class OpenVINOStableDiffusionPipeline(DiffusionPipeline):
159
  device_name="CPU")
160
 
161
  # Unet
162
- unet_onnx = ie.read_model(
163
- model=os.path.join(self.unet.model_save_dir, "model.onnx"))
164
  unet = ie.compile_model(model=unet_onnx, device_name="CPU")
165
 
166
  self.register_modules(vae_decoder=vae_decoder,
 
159
  device_name="CPU")
160
 
161
  # Unet
162
+ unet_onnx = ie.read_model(model=os.path.join(self.unet.model_save_dir, "model.onnx"))
 
163
  unet = ie.compile_model(model=unet_onnx, device_name="CPU")
164
 
165
  self.register_modules(vae_decoder=vae_decoder,