deinferno commited on
Commit
ca671f8
1 Parent(s): f99d5f3

Fix example

Browse files
Files changed (1) hide show
  1. README.md +9 -6
README.md CHANGED
@@ -16,18 +16,21 @@ This repo contains ONNX model files for [madebyollin's Tiny AutoEncoder for Stab
16
  To install the requirements for this demo, do pip install optimum["onnxruntime"].
17
 
18
  ```python
 
 
19
  from optimum.onnxruntime import ORTStableDiffusionPipeline
20
 
21
  model_id = "CompVis/stable-diffusion-v1-4"
22
- pipeline = ORTStableDiffusionPipeline.from_pretrained(model_id, revision="onnx")
23
 
24
- # Inject TAESD
25
 
26
- taesd_id = "deinferno/taesd-onnx"
27
- pipeline.vae_decoder = OnnxRuntimeModel.from_pretrained(taesd_id, subfolder = "vae_decoder")
28
- pipeline.vae_encoder = OnnxRuntimeModel.from_pretrained(taesd_id, subfolder = "vae_encoder")
 
 
29
 
30
  prompt = "sailing ship in storm by Leonardo da Vinci"
31
  image = pipeline(prompt).images[0]
32
- output.save("result.png")
33
  ```
 
16
  To install the requirements for this demo, do pip install optimum["onnxruntime"].
17
 
18
  ```python
19
+ from huggingface_hub import snapshot_download
20
+ from diffusers.pipelines import OnnxRuntimeModel
21
  from optimum.onnxruntime import ORTStableDiffusionPipeline
22
 
23
  model_id = "CompVis/stable-diffusion-v1-4"
 
24
 
25
+ taesd_dir = snapshot_download(repo_id="deinferno/taesd-onnx")
26
 
27
+ pipeline = ORTStableDiffusionPipeline.from_pretrained(
28
+ model_id,
29
+ vae_decoder_session = OnnxRuntimeModel.from_pretrained(f"{taesd_dir}/vae_decoder"),
30
+ vae_encoder_session = OnnxRuntimeModel.from_pretrained(f"{taesd_dir}/vae_encoder"),
31
+ revision="onnx")
32
 
33
  prompt = "sailing ship in storm by Leonardo da Vinci"
34
  image = pipeline(prompt).images[0]
35
+ image.save("result.png")
36
  ```