Skip to content

Add mps-cpu Support#71

Open
Tps-F wants to merge 14 commits into
lllyasviel:mainfrom
Tps-F:mps-cpu-support
Open

Add mps-cpu Support#71
Tps-F wants to merge 14 commits into
lllyasviel:mainfrom
Tps-F:mps-cpu-support

Conversation

@Tps-F

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

Copy link
Copy Markdown

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

Tps-F commented Feb 20, 2023

Copy link
Copy Markdown
Author

@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

justinseibert commented Feb 24, 2023

Copy link
Copy Markdown

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

Tps-F commented Feb 25, 2023

Copy link
Copy Markdown
Author

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

Tps-F commented Feb 25, 2023

Copy link
Copy Markdown
Author

@justinseibert The fix is in!
Thanks for your help

@yuanzhixiang

yuanzhixiang commented Mar 11, 2023

Copy link
Copy Markdown

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

@Bruce-shuai

Copy link
Copy Markdown

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

@tcmaps

tcmaps commented Aug 6, 2023

Copy link
Copy Markdown
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