sd-webui-controlnet icon indicating copy to clipboard operation
sd-webui-controlnet copied to clipboard

MacOS?

Open koen330 opened this issue 1 year ago • 3 comments

Is ControlNet compatible with MacOS. I could install it, and see it in the webUI, but when I use it, I get following error:

Loading preprocessor: canny, model: control_sd15_canny [fef5e48e] Loaded state_dict from [/Users/koen/Documents/SD/stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_sd15_canny.pth] ControlNet model control_sd15_canny [fef5e48e] loaded. 0%| | 0/16 [00:00<?, ?it/s]loc("mps_add"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":219:0)): error: input types 'tensor<2x1280xf32>' and 'tensor<*xf16>' are not broadcast compatible LLVM ERROR: Failed to infer result type(s). zsh: abort ./webui.sh koen@Koens-MacBook-Pro-2 stable-diffusion-webui % /opt/homebrew/Cellar/[email protected]/3.10.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '

Shortly after "Python quit unexpectedly"

Koen

koen330 avatar Feb 16 '23 08:02 koen330

Related: #68, will fix later

Mikubill avatar Feb 16 '23 08:02 Mikubill

Make sure you start web UI with --no-half for now. I do plan to try to get it working without --no-half but it may be up to a few days until I have enough time for that.

brkirch avatar Feb 16 '23 10:02 brkirch

--no-half seems to work. Thanks!!

koen330 avatar Feb 16 '23 10:02 koen330

Just a note to say that the latest commit of this repo works fine with A1111 on macOS (M2) and any model that is based on SD1.5 without the need of --no-half. These are my startup flags (recommended by @brkirch in other threads) and OS environment:

--theme=dark --upcast-sampling --opt-sub-quad-attention --use-cpu interrogate

python: 3.10.9  •  torch: 2.0.0  •  xformers: N/A  •  gradio: 3.16.2  •  commit: [3715ece0]

However, any attempt to use SD2.1 (even the 512x512px model) or a model based on it (e.g.,Future Diffusion or Robo Diffusion v2), will generate the following error:

(mpsFileLoc): /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:39:0: error: 'mps.matmul' op contracting dimensions differ 1024 & 768 (mpsFileLoc): /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:39:0: note: see current operation: %3 = "mps.matmul"(%arg0, %2) {transpose_lhs = false, transpose_rhs = false} : (tensor<2x77x1024xf32>, tensor<768x320xf32>) -> tensor<2x77x320xf32> ./automatic1111.sh: line 16: 27859 Segmentation fault: 11

and

/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '

I tried to add --no-half, but it makes no difference.

Also, flagging Upcast cross attention layer to float32 inside A1111 makes no difference either.

system1system2 avatar Feb 18 '23 15:02 system1system2

error: 'mps.matmul' op contracting dimensions differ 1024 & 768

Pretrained controlnet model is for sd1.5/sd1.4, not compatible with sd2/sd2.1/inpainting model.

Mikubill avatar Feb 18 '23 15:02 Mikubill

another error seemingly related with macOS or could the execution model be a problem - currently using wd15 should I use default sd? --no-half is added

(mpsFileLoc): /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:39:0: error: 'mps.matmul' op contracting dimensions differ 1024 & 768 (mpsFileLoc): /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm:39:0: note: see current operation: %5 = "mps.matmul"(%arg0, %4) {transpose_lhs = false, transpose_rhs = false} : (tensor<2x77x1024xf32>, tensor<768x320xf32>) -> tensor<2x77x320xf32> /opt/homebrew/Cellar/[email protected]/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d ' zsh: segmentation fault sh webui.sh

ok edit: seems to run with default so next question - can I get it to run with another model

a-starry-night avatar Jun 05 '23 13:06 a-starry-night

the same error happy "segmentation fault":

  • success commit: 9ea19a74a027a29e0a80c1b9f901331a82d63db3
  • error commit: ca03f4e3d8a4839009af083d305aa195be956c01

LightGlobal avatar Jun 19 '23 13:06 LightGlobal

Bildschirmfoto 2023-07-17 um 19 18 09 Please help. It is still not working for me. M1 Air 8GB

linusqqqq avatar Jul 17 '23 17:07 linusqqqq