When you want it to run on GNU\Linux, follow the ROCm guide. (https://rentry.org/sdamd)
You have installed Python 3.x (min. 3.7)
A huggingface.co account (to generate and download the stable-diffusion v1.4 model)
- Make a folder where you will download all stuff into
- Open Command Line (as Administrator, or it will fail later on because of symlinks)
- Clone special hack version by harishanand95
git clone https://github.com/harishanand95/diffusers.git
cd diffusers && git checkout dml && pip install -e .
pip install transformers ftfy scipy
- Check for the newest nightly of onnx and download it (at time of writing it was "1.13.0.dev20220901005")
If you are on Python 3.7 download the file that ends with
If you are on Python 3.8 download the file that ends with
If you are on Python 3.9 download the file that ends with
If you are on Python 3.10 download the file that ends with
- I still use Python 3.7 so for me it is:
- Download it and install it
pip install ort_nightly_directml-1.13.0.dev20220901005-cp37-cp37m-win_amd64.whl
An error message like this "ERROR: ort_nightly_directml-1.13.0.dev20220830001-cp38-cp38-win_amd64.whl is not a supported wheel on this platform." means that there is mismatch in python version and the downloaded package supported python version.
- Go to folder "diffusers\examples\inference"
- Login via cli and generate a token (huggingface-cli was installed by transformers package)
- Start downloading and generating of stable-diffusion v1.4 model
- Open dml_onnx.py with notepad and edit what you want to generate at the bottom of the file in "prompt" variable
- Default for testing is:
prompt = "a photo of an astronaut riding a horse on mars"
- Save and execute with "python ./dml_onnx.py"
- After a bit of time you will get a png in the "diffusers\examples\inference" folder.
I have about ~3.30/it on my good ol AMD RX 480 and a image takes about "2:30 min". You should have a higher number.