Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Assets/Samples/1207582124_30_7.5_30_DDIM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Samples/1207582124_30_7.5_30_DDPM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Samples/1207582124_30_7.5_30_Euler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Samples/1207582124_30_7.5_30_KDPM2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Samples/1207582124_30_7.5_30_LMS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions OnnxStack.UI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<p align="center" width="100%">
<img width="80%" src="Assets/OnnxStack - 640x320.png">
</p>


![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/saddam213/OnnxStack)
[![Core Badge](https://img.shields.io/nuget/v/OnnxStack.Core?color=4bc51e&label=OnnxStack.Core)](https://www.nuget.org/packages/OnnxStack.Core)
![Nuget](https://img.shields.io/nuget/dt/OnnxStack.Core)
[![StableDiffusion Badge](https://img.shields.io/nuget/v/OnnxStack.StableDiffusion?color=4bc51e&label=OnnxStack.StableDiffusion)](https://www.nuget.org/packages/OnnxStack.StableDiffusion)
![Nuget](https://img.shields.io/nuget/dt/OnnxStack.StableDiffusion)



### Welcome to OnnxStack WPF GUI!
This project is a sample WPF GUI of the OnnxStack library's Inference Stable Diffusion implementation.

### **Prompt**

Stable Diffusion models take a text prompt and create an image that represents the text.

*Example:*
`
final fantasy style cyberpunk desert assassin girl with thigh-high boot
`

### **Negative Prompt**

A negative prompt can be provided to guide the inference to exclude in calculations

*Example:*

`
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,
`

### **Schedulers**

Many different scheduler algorithms can be used for this computation, each having its pro- and cons.
So far `OnnxStack.StableDiffusion` as included `LMS Discrete`, `Euler`, `Euler Ancestral`, `DDPM`, `DDIM`, `KDPM2` options with more in the works.

*Example:*
| LMS Scheduler | Euler Scheduler | Euler Ancestral Scheduler | DDPM Scheduler | DDIM Scheduler | KDPM2 Scheduler
| :--- | :--- | :--- | :--- | :--- | :--- |
<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."/> |

Model: OpenJourney V4 Seed: 1207582124 GuidanceScale: 7.5 NumInferenceSteps: 30 Prompt: A cyberpunk puppy

__________________________

# Getting Started


## ONNX Model Download
You will need an ONNX compatible model to use, Hugging Face is a great place to download the Stable Diffusion models

Download the [ONNX Stable Diffusion models from Hugging Face](https://huggingface.co/models?sort=downloads&search=Stable+Diffusion).

- [Stable Diffusion Models v1.4](https://huggingface.co/CompVis/stable-diffusion-v1-4/tree/onnx)
- [Stable Diffusion Models v1.5](https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/onnx)


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.

Clone the model repo:
```text
git lfs install
git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 -b onnx
```


## Stable Diffusion Models We've Converted To ONNX And Tested
The following are othe stable diffusion models we've converted to ONNX and tested with OnnxStack.

- [OpenJourney V4](https://huggingface.co/TheyCallMeHex/OpenJourney-V4-ONNX)
- [DreamLike PhotoReal 2.0](https://huggingface.co/TheyCallMeHex/DreamLike-PhotoReal-2.0-ONNX)
- [CyberPunk Anime Diffusion](https://huggingface.co/TheyCallMeHex/Cyberpunk-Anime-Diffusion-ONNX)
- [InkPunk Diffusion](https://huggingface.co/TheyCallMeHex/Inkpunk-Diffusion-ONNX)
- [Mo-Di Diffusion](https://huggingface.co/TheyCallMeHex/Mo-Di-Diffusion-ONNX)
- [epiCRealism](https://huggingface.co/TheyCallMeHex/epiCRealism-ONNX)
- [Comic Diffusion](https://huggingface.co/TheyCallMeHex/Comic-Diffusion-ONNX)
- [Redshift Diffusion](https://huggingface.co/TheyCallMeHex/Redshift-Diffusion-ONNX)

## Hardware Requirements
You can choose between `Cpu` and `DirectML`(GPU) for inference,
Other `Microsoft.ML.OnnxRuntime.*` executors like `Cuda` may work but are untested

`Cpu` > 12GB RAM

`DirectML` > 10GB VRAM



## Contribution

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.



__________________________
## Resources
- [ONNX Runtime C# API Doc](https://onnxruntime.ai/docs/api/csharp/api)
- [Get Started with C# in ONNX Runtime](https://onnxruntime.ai/docs/get-started/with-csharp.html)
- [Hugging Face Stable Diffusion Blog](https://huggingface.co/blog/stable_diffusion)
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ painting, drawing, sketches, monochrome, grayscale, illustration, anime, cartoon
### **Schedulers**

Many different scheduler algorithms can be used for this computation, each having its pro- and cons.
So far `OnnxStack.StableDiffusion` as included `LMS Discrete`, `Euler Ancestral`, and `DDPM`, and `DDIM` options with more in the works.
So far `OnnxStack.StableDiffusion` as included `LMS Discrete`, `Euler Ancestral`, `DDPM`, `DDIM`, and `KDPM2` options with more in the works.

*Example:*
| LMS Scheduler | Euler Ancestral Scheduler | DDPM Scheduler |
Expand Down Expand Up @@ -132,6 +132,19 @@ git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 -b onnx
```


## Stable Diffusion Models We've Converted To ONNX And Tested
The following are othe stable diffusion models we've converted to ONNX and tested with OnnxStack.

- [OpenJourney V4](https://huggingface.co/TheyCallMeHex/OpenJourney-V4-ONNX)
- [DreamLike PhotoReal 2.0](https://huggingface.co/TheyCallMeHex/DreamLike-PhotoReal-2.0-ONNX)
- [CyberPunk Anime Diffusion](https://huggingface.co/TheyCallMeHex/Cyberpunk-Anime-Diffusion-ONNX)
- [InkPunk Diffusion](https://huggingface.co/TheyCallMeHex/Inkpunk-Diffusion-ONNX)
- [Mo-Di Diffusion](https://huggingface.co/TheyCallMeHex/Mo-Di-Diffusion-ONNX)
- [epiCRealism](https://huggingface.co/TheyCallMeHex/epiCRealism-ONNX)
- [Comic Diffusion](https://huggingface.co/TheyCallMeHex/Comic-Diffusion-ONNX)
- [Redshift Diffusion](https://huggingface.co/TheyCallMeHex/Redshift-Diffusion-ONNX)


## Hardware Requirements
You can choose between `Cpu` and `DirectML`(GPU) for inference,
Other `Microsoft.ML.OnnxRuntime.*` executors like `Cuda` may work but are untested
Expand Down