Uminosachi / sd-webui-inpaint-anything

Inpaint Anything extension performs stable diffusion inpainting on a browser UI using masks from Segment Anything.
Apache License 2.0
1.11k stars 101 forks source link

Apple M2 uses model "sam_vit_l_0b3195.pth" error #138

Open WKnight233 opened 7 months ago

WKnight233 commented 7 months ago

Apple M2 uses model "sam_vit_l_0b3195.pth", and after clicking "Segment anything", the error is reported as follows: loc("mps_not_equal"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":253:0)): error: 'anec.not_equal_zero' op Invalid configuration for the following reasons: Tensor dimensions N1D1C1H1W21757869 are not within supported range, N[1-65536]D[1-16384]C[1-65536]H[1-16384]W[1-16384]. loc("mps_select"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":294:0)): error: 'anec.not_equal_zero' op Invalid configuration for the following reasons: Tensor dimensions N1D1C1H1W21757869 are not within supported range, N[1-65536]D[1-16384]C[1-65536]H[1-16384]W[1-16384]. I think tensor dimension N1D1C1H1W21757869, is not a normal value

Uminosachi commented 4 months ago

It appears that using an older version of torch can cause errors on Mac OS. I have confirmed that upgrading to torch version 2.1.0 or higher resolves the issue. You can delete the venv folder under stable-diffusion-webui, and then run webui.sh to install the new version of torch.