-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workaround for MPS gather crash #15
Conversation
Oh sweet, I didn't realize the fix was this simple. I don't have an MPS device to test this on, so can someone else (e.g., @KohakuBlueleaf or @tvdtran) confirm that it works for them? Edit: Also this might fix this directml issues (#13). If so, the workaround could be applied if the device type is "mps" or "dml". |
I tried it with with directml: https://github.com/lshqqytiger/stable-diffusion-webui-directml and still got an error in: |
Thanks for testing this. Seems like the directml issue is separate then, unfortunately. Then we can keep this as a fix just for MPS and look into a separate fix for directml. |
Using this patched tomesd version in a simple python diffusers pipeline threw an error saying I needed to set an environment variable: export PYTORCH_ENABLE_MPS_FALLBACK=1 Worked after that. A 768x768 straight generation went from 3.75 s/it without tomesd to 2.13 s/it using tomesd at .5 so I assume the "fallback" isn't a big detriment, if at all. I don't know how to do Hires fix with python commands yet, so I can't test this all the way. |
Sounds good to me. Requiring |
This is a workaround for gather on MPS that uses unsqueeze before gather and squeeze afterwards so that gather doesn't cause a crash. Fixes #4.