This is a fix to get stable_txt2img working on an M1 Mac.#36
Conversation
- Install Stable Diffusion as per https://medium.com/gft-engineering/macbook-m1-how-to-install-and-run-stable-diffusion-7bfb2f802b1a - Install PyTorch by running `conda install pytorch torchvision torchaudio -c pytorch-nightly` Running with more than one sample seems to break it so I'm just running multiple itterations to get the regularization images. `python scripts/stable_txt2img.py --ddim_eta 0.0 --n_samples 1 --n_iter 200 --scale 10.0 --ddim_steps 50 --ckpt ~/Downloads/sd-v1-4-full-ema.ckpt --prompt "a photo of a <class>`
|
How long is it taking you to train the models this way? |
|
I can't get this repo (not the lstein one mentionned by OP) to train on M1. |
|
@swankwc I haven't gotten to training yet. ATM his patch is just for I'm having problems getting I can keep using this PR to track that work or open a new one. Opinions? |
|
@Sorrow do you have your work somewhere? You seem to have gotten further than me. Maybe we can collaborate. Here's my WIP, it's very rough ATM https://github.com/beettlle/Dreambooth-Stable-Diffusion/tree/m1-training-fix |
|
Renamed PR explain scope of work better. |
|
@beettlle, I've been able to get it up and running on my Macbook Pro with some modifications using your code. It's linked here if you'd like to take a look: https://github.com/SujeethJinesh/DreamBoothMac |
|
That's awesome @SujeethJinesh ! Let me reset my env and I'll try it tomorrow. |
|
@SujeethJinesh I'm still getting the following error with your branch. Any ideas? |
|
is there any progress (in @SujeethJinesh's built)? i cant even generate the regularization images on MPS as it doesnt support double precision floats, but sd requires them |
|
I tried running @SujeethJinesh 's repo and got the same error as you @HannesGitH . Some additional things I was to install the following |
|
My latest attempt to fix was to perform the cast as follows but that gave me this error |
|
@SujeethJinesh open a PR SujeethJinesh/DreamBoothMac#3 to fix the float64 error. I was able to get around the error I changed the size of the image to 256 x 256 that did the trick. It unblocks me for now, but it would be good to figure out a better solution. I will try to fix later. |
|
In my latest attempt I tried to perform training I get the following error My best guess is that the pytorch lighting version specified (1.5.9) does have this feature https://lightning.ai/docs/pytorch/stable/accelerators/mps_basic.html @SujeethJinesh how did you get this work? |
|
@alberto-salinas would you mind trying the following from 's site in your environment to see if MPS is supported? Output should be: |
conda install pytorch torchvision torchaudio -c pytorch-nightlyRunning with more than one sample seems to break it so I'm just running multiple itterations to get the regularization images:
python scripts/stable_txt2img.py --ddim_eta 0.0 --n_samples 1 --n_iter 200 --scale 10.0 --ddim_steps 50 --ckpt ~/Downloads/sd-v1-4-full-ema.ckpt --prompt "a photo of a <class>