|
--- |
|
license: mit |
|
pipeline_tag: text-to-image |
|
tags: |
|
- onnx |
|
- text-to-image |
|
inference: false |
|
--- |
|
|
|
## Model Descriptions: |
|
|
|
This repo contains ONNX model files for [madebyollin's Tiny AutoEncoder for Stable Diffusion](https://huggingface.co/madebyollin/taesd). |
|
|
|
## Using in 🧨 diffusers |
|
|
|
To install the requirements for this demo, do pip install optimum["onnxruntime"]. |
|
|
|
```python |
|
from huggingface_hub import snapshot_download |
|
from diffusers.pipelines import OnnxRuntimeModel |
|
from optimum.onnxruntime import ORTStableDiffusionPipeline |
|
|
|
model_id = "CompVis/stable-diffusion-v1-4" |
|
|
|
taesd_dir = snapshot_download(repo_id="deinferno/taesd-onnx") |
|
|
|
pipeline = ORTStableDiffusionPipeline.from_pretrained( |
|
model_id, |
|
vae_decoder_session = OnnxRuntimeModel.from_pretrained(f"{taesd_dir}/vae_decoder"), |
|
vae_encoder_session = OnnxRuntimeModel.from_pretrained(f"{taesd_dir}/vae_encoder"), |
|
revision="onnx") |
|
|
|
prompt = "sailing ship in storm by Leonardo da Vinci" |
|
image = pipeline(prompt).images[0] |
|
image.save("result.png") |
|
``` |
|
|