Skip to content
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 mps-cpu Support #71

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Add mps-cpu Support #71

wants to merge 14 commits into from

Conversation

Tps-F
Copy link

@Tps-F Tps-F commented Feb 16, 2023

Summary

・Adapted stablediffusion to work on M1 mac(mps) and CPU

Currently not feasible

・gradio_seg2image.py(Reason:aten::_slow_conv2d_forward is currently not supported by mps.)

@Tps-F
Copy link
Author

Tps-F commented Feb 20, 2023

@lllyasviel Sorry to be so busy, but can I get a review?
I want to help more people use this

@Tps-F Tps-F closed this Feb 21, 2023
@Tps-F Tps-F deleted the mps-cpu-support branch February 21, 2023 03:17
@Tps-F Tps-F restored the mps-cpu-support branch February 21, 2023 03:17
@Tps-F Tps-F reopened this Feb 21, 2023
@justinseibert
Copy link

justinseibert commented Feb 24, 2023

I am trying to test this on an M1 Mac, but am experiencing issues with the conda environment configuration. I would recommend adding an environment.yaml targeted for MPS/CPU.

In order to get the conda environment to install correctly, I had to remove cudatoolkit (doesn't exist for Mac) and change versions for python, pip, and opencv-contrib-python. I also needed rust (it wasn't already on my system) in order to get some of the pip packages to install, but not ready to suggest this is necessary.

dependencies:
-  - python=3.8.5
-  - pip=20.3
-  - cudatoolkit
+  - python=3.8
+  - pip=22.3
+  - rust
  - pip:
-      - opencv-contrib-python==4.3.0.36
+      - opencv-contrib-python

With those changes, I was finally able to activate the conda environment and launch the gradio_scribble2image.py example.

However, when trying to "run" the example, I get an AssertionError that originates from cldm/ddim_hacked.py:97 stating that "Torch not compiled with CUDA enabled" even though I am not trying to run with CUDA (I made sure to set PYTORCH_ENABLE_MPS_FALLBACK=1 when launching).

@Tps-F
Copy link
Author

Tps-F commented Feb 25, 2023

I forgot about it. Thanks for pointing that out!

However, when trying to "run" the example, I get an AssertionError

I found the cause and will fix it now.Sorry

@Tps-F
Copy link
Author

Tps-F commented Feb 25, 2023

@justinseibert The fix is in!
Thanks for your help

@yuanzhixiang
Copy link

yuanzhixiang commented Mar 11, 2023

@lllyasviel Can you merge this PR as soon as possible, I also encountered this problem locally, thanks

@Bruce-shuai
Copy link

i very hope pip install controlnet can also support macOS, thanks!

@tcmaps
Copy link

tcmaps commented Aug 6, 2023

dependencies:
  - pip:
-      - opencv-contrib-python==4.3.0.36
+      - opencv-contrib-python

Take the chance to also replace opencv-contrib-python with opencv-contrib-python-headless, it skips some nasty glib deps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants