TouchDesigner implementation for real-time Stable Diffusion interactive generation with StreamDiffusion.
Benchmarks with stabilityai/sd-turbo, 512x512 and 1 batch size.
GPU | FPS |
---|---|
4090 | 55-60 FPS |
4080 | 47 FPS |
3090ti | 37 FPS |
3090 | 30-32 FPS |
4070 Laptop | 24 FPS |
3060 12GB | 16 FPS |
Notice: This repository is in an early testing phase and may undergo significant changes. Use it at your own risk.
Required TouchDesigner 2023 & Python 3.11
You can follow YouTube tutorial
- Install Python 3.11
- Install Git
- Install CUDA Toolkit 11.8 (required PC restart)
- Download TouchDiffusion.
- Open
webui.bat
with text editor and set path to Python 3.11 inset PYTHON_PATH=
. (ex.set PYTHON_PATH="C:\Program Files\Python311\python.exe"
) - Run
webui.bat
. After installation it will provide url to web interface (ex.http://127.0.0.1:7860
) - Open
install & update
tab and runUpdate dependencies
. (could take ~10 minutes, depending on your internet connection) - If you get pop up window with error related to .dll, run
Fix pop up
- Restart webui.bat
Models in .safetensors
format must be in models\checkpoints
folder. (as for sd_turbo, it will be auto-downloaded).
Internet connection required, while making engines.
- Run
webui.bat
- Select model type.
- Select model.
- Set width, height and amount of sampling steps (Batch size)
- Select acceleration lora if available.
- Run
Make engine
and wait for acceleration to finish. (could take ~10 minutes, depending on your hardware)
- Add TouchDiffusion.tox to project
- On
Settings
page change path toTouchDiffusion
folder (same as where webui.bat). - Save and restart TouchDesigner project.
- On
Settings
page select Engine and click Load Engine. - Connect animated TOP to input. Component cook only if input updates.
- Fix Re-init. Sometimes required to restart TouchDesigner for initializing site-packages.
- Code clean-up and rework.
- Custom resolution (for now fixed 512x512)
- CFG not affecting image
- Add Lora
- Add Hyper Lora support
- Add ControlNet support
- Add SDXL support
Based on the following projects:
- StreamDiffusion - Pipeline-Level Solution for Real-Time Interactive Generation
- TopArray - Interaction between Python/PyTorch tensor operations and TouchDesigner TOPs.