lemonteaa/sdxs-onnx
By lemonteaa · ↓ 0 · ♥ 1 · Updated 2024-04-28
What's in this repo
This page lists the files in lemonteaa/sdxs-onnx, including model.onnx and more.
- 4 ONNX models (.onnx files)
- 17 files, including 10 .json, 4 .onnx, 1 .md, 1 .txt
- Last updated 2024-04-28
ONNX files
| File | Size | Download |
|---|---|---|
| text_encoder/model.onnx | — | Download |
| unet/model.onnx | — | Download |
| vae_decoder/model.onnx | — | Download |
| vae_encoder/model.onnx | — | Download |
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
SDXS Onnx
Converted from IDKiro/sdxs-512-0.9 (i.e. the original one, without dreamshaper) through this command:
optimum-cli export onnx -m <local absolute path to original model> --task stable-diffusion ./mysdxs
Notice that I replaced the /vae folder in the local copy of the repo with /vae_large in that same repo, and updated the model config at the repo root. This is because the Onnx converter doesn't currently seem mature enough to handle nonstandard pipeline so we're effectively using the original, ordinary autoencoder.
For actual inference, you can test with something like:
from optimum.onnxruntime import ORTStableDiffusionPipeline
pipeline = ORTStableDiffusionPipeline.from_pretrained("/local/absolute/path/to/repo")
prompt = "Sailing ship in storm by Leonardo da Vinci"
image = pipeline(prompt, num_inference_steps=1, guidance_scale=0).images[0]
image.save("hello.png", "PNG")
Using with TAESD
(Not tested yet)
Consider using the Onnx converted model of TAESD at deinferno/taesd-onnx (Original model at madebyollin/taesd )
Combined inference code:
from huggingface_hub import snapshot_download
from diffusers.pipelines import OnnxRuntimeModel
from optimum.onnxruntime import ORTStableDiffusionPipeline
taesd_dir = snapshot_download(repo_id="deinferno/taesd-onnx")
pipeline = ORTStableDiffusionPipeline.from_pretrained(
"lemonteaa/sdxs-onnx",
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, num_inference_steps=1, guidance_scale=0).images[0]
image.save("hello.png", "PNG")
Model info
Created: 2024-04-28
Updated: 2024-04-28
View on Hugging Face