|
| 1 | +<p align="center" width="100%"> |
| 2 | + <img width="80%" src="Assets/OnnxStack - 640x320.png"> |
| 3 | +</p> |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +[](https://www.nuget.org/packages/OnnxStack.Core) |
| 8 | + |
| 9 | +[](https://www.nuget.org/packages/OnnxStack.StableDiffusion) |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +### Welcome to OnnxStack WPF GUI! |
| 15 | +This project is a sample WPF GUI of the OnnxStack library's Inference Stable Diffusion implementation. |
| 16 | + |
| 17 | +### **Prompt** |
| 18 | + |
| 19 | +Stable Diffusion models take a text prompt and create an image that represents the text. |
| 20 | + |
| 21 | +*Example:* |
| 22 | +` |
| 23 | +final fantasy style cyberpunk desert assassin girl with thigh-high boot |
| 24 | +` |
| 25 | + |
| 26 | +### **Negative Prompt** |
| 27 | + |
| 28 | +A negative prompt can be provided to guide the inference to exclude in calculations |
| 29 | + |
| 30 | +*Example:* |
| 31 | + |
| 32 | +` |
| 33 | +painting, drawing, sketches, monochrome, grayscale, illustration, anime, cartoon, graphic, text, crayon, graphite, abstract, easynegative, low quality, normal quality, worst quality, lowres, close up, cropped, out of frame, jpeg artifacts, duplicate, morbid, mutilated, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, glitch, deformed, mutated, cross-eyed, ugly, dehydrated, bad anatomy, bad proportions, gross proportions, cloned face, disfigured, malformed limbs, missing arms, missing legs fused fingers, too many fingers,extra fingers, extra limbs,, extra arms, extra legs,disfigured, |
| 34 | +` |
| 35 | + |
| 36 | +### **Schedulers** |
| 37 | + |
| 38 | +Many different scheduler algorithms can be used for this computation, each having its pro- and cons. |
| 39 | +So far `OnnxStack.StableDiffusion` as included `LMS Discrete`, `Euler`, `Euler Ancestral`, `DDPM`, `DDIM`, `KDPM2` options with more in the works. |
| 40 | + |
| 41 | +*Example:* |
| 42 | +| LMS Scheduler | Euler Scheduler | Euler Ancestral Scheduler | DDPM Scheduler | DDIM Scheduler | KDPM2 Scheduler |
| 43 | +| :--- | :--- | :--- | :--- | :--- | :--- | |
| 44 | +<img src="../Assets/Samples/1207582124_30_7.5_30_LMS.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="../Assets/Samples/1207582124_30_7.5_30_Euler.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="../Assets/Samples/1207582124_30_7.5_30_EulerAncestral.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="../Assets/Samples/1207582124_30_7.5_30_DDPM.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="../Assets/Samples/1207582124_30_7.5_30_DDIM.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="../Assets/Samples/1207582124_30_7.5_30_KDPM2.png" width="256" alt="Image of browser inferencing on sample images."/> | |
| 45 | + |
| 46 | + Model: OpenJourney V4 Seed: 1207582124 GuidanceScale: 7.5 NumInferenceSteps: 30 Prompt: A cyberpunk puppy |
| 47 | + |
| 48 | +__________________________ |
| 49 | + |
| 50 | +# Getting Started |
| 51 | + |
| 52 | + |
| 53 | +## ONNX Model Download |
| 54 | +You will need an ONNX compatible model to use, Hugging Face is a great place to download the Stable Diffusion models |
| 55 | + |
| 56 | +Download the [ONNX Stable Diffusion models from Hugging Face](https://huggingface.co/models?sort=downloads&search=Stable+Diffusion). |
| 57 | + |
| 58 | +- [Stable Diffusion Models v1.4](https://huggingface.co/CompVis/stable-diffusion-v1-4/tree/onnx) |
| 59 | +- [Stable Diffusion Models v1.5](https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/onnx) |
| 60 | + |
| 61 | + |
| 62 | +Once you have selected a model version repo, click `Files and Versions`, then select the `ONNX` branch. If there isn't an ONNX model branch available, use the `main` branch and convert it to ONNX. See the [ONNX conversion tutorial for PyTorch](https://learn.microsoft.com/windows/ai/windows-ml/tutorials/pytorch-convert-model) for more information. |
| 63 | + |
| 64 | +Clone the model repo: |
| 65 | +```text |
| 66 | +git lfs install |
| 67 | +git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 -b onnx |
| 68 | +``` |
| 69 | + |
| 70 | + |
| 71 | +## Stable Diffusion Models We've Converted To ONNX And Tested |
| 72 | +The following are othe stable diffusion models we've converted to ONNX and tested with OnnxStack. |
| 73 | + |
| 74 | +- [OpenJourney V4](https://huggingface.co/TheyCallMeHex/OpenJourney-V4-ONNX) |
| 75 | +- [DreamLike PhotoReal 2.0](https://huggingface.co/TheyCallMeHex/DreamLike-PhotoReal-2.0-ONNX) |
| 76 | +- [CyberPunk Anime Diffusion](https://huggingface.co/TheyCallMeHex/Cyberpunk-Anime-Diffusion-ONNX) |
| 77 | +- [InkPunk Diffusion](https://huggingface.co/TheyCallMeHex/Inkpunk-Diffusion-ONNX) |
| 78 | +- [Mo-Di Diffusion](https://huggingface.co/TheyCallMeHex/Mo-Di-Diffusion-ONNX) |
| 79 | +- [epiCRealism](https://huggingface.co/TheyCallMeHex/epiCRealism-ONNX) |
| 80 | +- [Comic Diffusion](https://huggingface.co/TheyCallMeHex/Comic-Diffusion-ONNX) |
| 81 | +- [Redshift Diffusion](https://huggingface.co/TheyCallMeHex/Redshift-Diffusion-ONNX) |
| 82 | + |
| 83 | +## Hardware Requirements |
| 84 | +You can choose between `Cpu` and `DirectML`(GPU) for inference, |
| 85 | +Other `Microsoft.ML.OnnxRuntime.*` executors like `Cuda` may work but are untested |
| 86 | + |
| 87 | +`Cpu` > 12GB RAM |
| 88 | + |
| 89 | +`DirectML` > 10GB VRAM |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +## Contribution |
| 94 | + |
| 95 | +We welcome contributions to OnnxStack! If you have any ideas, bug reports, or improvements, feel free to open an issue or submit a pull request. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +__________________________ |
| 100 | +## Resources |
| 101 | +- [ONNX Runtime C# API Doc](https://onnxruntime.ai/docs/api/csharp/api) |
| 102 | +- [Get Started with C# in ONNX Runtime](https://onnxruntime.ai/docs/get-started/with-csharp.html) |
| 103 | +- [Hugging Face Stable Diffusion Blog](https://huggingface.co/blog/stable_diffusion) |
0 commit comments