ONNX 模型库
返回模型

说明文档

SDXS Onnx

IDKiro/sdxs-512-0.9(即原始版本,不含 dreamshaper)通过以下命令转换而来:

optimum-cli export onnx -m <本地原始模型的绝对路径> --task stable-diffusion ./mysdxs

请注意,我将本地仓库副本中的 /vae 文件夹替换为同一仓库中的 /vae_large,并更新了仓库根目录的模型配置。这是因为 Onnx 转换器目前似乎还不够成熟,无法处理非标准流水线,因此我们实际上使用的是原始的普通自编码器。

实际推理时,可以使用类似以下的代码进行测试:

from optimum.onnxruntime import ORTStableDiffusionPipeline

pipeline = ORTStableDiffusionPipeline.from_pretrained(\"/本地仓库的绝对路径\")

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\")

配合 TAESD 使用

(尚未测试)

可以考虑使用 deinferno/taesd-onnx 中的 TAESD Onnx 转换模型(原始模型位于 madebyollin/taesd

组合推理代码:

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\")

lemonteaa/sdxs-onnx

作者 lemonteaa

text-to-image
↓ 0 ♥ 1

创建时间: 2024-04-28 02:15:04+00:00

更新时间: 2024-04-28 14:11:04+00:00

在 Hugging Face 上查看

文件 (17)

.gitattributes
README.md
feature_extractor/preprocessor_config.json
model_index.json
scheduler/scheduler_config.json
text_encoder/config.json
text_encoder/model.onnx ONNX
tokenizer/merges.txt
tokenizer/special_tokens_map.json
tokenizer/tokenizer_config.json
tokenizer/vocab.json
unet/config.json
unet/model.onnx ONNX
vae_decoder/config.json
vae_decoder/model.onnx ONNX
vae_encoder/config.json
vae_encoder/model.onnx ONNX