https://github.com/haoming02/stable-diffusion-for-unity
A project that allows you to run Stable Diffusion NATIVELY inside Unity at runtime
https://github.com/haoming02/stable-diffusion-for-unity
csharp deprecated onnx stable-diffusion unity
Last synced: 10 months ago
JSON representation
A project that allows you to run Stable Diffusion NATIVELY inside Unity at runtime
- Host: GitHub
- URL: https://github.com/haoming02/stable-diffusion-for-unity
- Owner: Haoming02
- License: mit
- Created: 2023-04-17T02:37:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-19T12:23:02.000Z (over 2 years ago)
- Last Synced: 2024-01-19T18:46:39.894Z (over 2 years ago)
- Topics: csharp, deprecated, onnx, stable-diffusion, unity
- Language: C#
- Homepage:
- Size: 78.1 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
No Longer Maintained
This project was originally just a proof of concept. With so many new optimization techniques, such as Turbo, this implementation is extremely slow by today's standard...
# Stable Diffusion for Unity
This is an Unity project that allows you to run the Stable Diffusion pipeline within Unity,
achieved by using `ONNX` version of the models and `OnnxRuntime` to inference at runtime.
## Requirements
- [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit-archive)
- [CUDA Deep Neural Network](https://developer.nvidia.com/cudnn)
- [ONNX Runtime](https://onnxruntime.ai/docs/tutorials/csharp/csharp-gpu.html)
> as shown in the `Plugins` folder
#### Supported Versions
- This project was built on **ONNX Runtime** `1.15.1`
- Tested on **CUDA** `v11.6` and `v11.8`
- Tested on **CUDNN** `v8.5.0.96`
## Getting Started
- Download the models from [**Release**](https://github.com/Haoming02/stable-diffusion-for-unity/releases), and put them into the `StreamingAssets` folder.
- 2 sample scenes are included:
- One is a simple UI where you can enter any prompt and adjust some settings to generate an image
- Another is a 3D scene where you can generate a skybox and a painting
## Implemented Features
- Positive Prompt
- Steps
- **Euler a** sampling method
- CFG Scale
- Inference `fp16` Precision
# References
- https://onnxruntime.ai/docs/tutorials/csharp/stable-diffusion-csharp.html
- https://github.com/cassiebreviu/StableDiffusion
- https://onnxruntime.ai/docs/get-started/with-csharp.html
- https://onnxruntime.ai/docs/tutorials/csharp/csharp-gpu.html