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

MPS error on Apple M2Pro?

Open atpxu opened this issue 1 year ago • 4 comments

According to previous issues, I added --use-cpu all and --no-half to webui-user.sh like:

export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu all --no-half --disable-nan-check"

and add environment to webui-macos-env.sh

export PYTORCH_ENABLE_MPS_FALLBACK=1

however it report error:

RuntimeError: Input type (MPSFloatType) and weight type (torch.FloatTensor) should be the same

I traced into the code and found line 663 in controlnet.py: control = torch.from_numpy(detected_map.copy()).float().to(devices.get_device_for("controlnet")) and image

which returns "mps". Does it mean control is using MPS although I set use_cpu?

I wonder if I used wrong command_argument or it's a bug? Any solutions?

atpxu avatar Mar 04 '23 08:03 atpxu

I removed if has_mps(): return "mps"

and it works.

atpxu avatar Mar 04 '23 09:03 atpxu

I removed if has_mps(): return "mps"

and it works.

is it related to just controlnet or also the t2iadapter (style adapter) ?

trendland avatar Mar 12 '23 18:03 trendland

testing to see if it works, but i do not find MPS calls in the controlnet.py

trendland avatar Mar 12 '23 18:03 trendland

I have the same issue with the extension when trying to run t2iadapter_sketch-fp16 [75b15924] from https://huggingface.co/webui/ControlNet-modules-safetensors/tree/main the Controlnets are working just fine. (like diff_control_sd15_scribble_fp16 [1f29174d]) I'm also on running it on a MacPro with M1

tabledevil avatar Mar 15 '23 10:03 tabledevil