bes-dev / stable_diffusion.openvino

Apache License 2.0
1.53k stars 208 forks source link

Does this project work on Mac M1 CPU? #15

Open IPL opened 1 year ago

IPL commented 1 year ago

I tried but always failed in below line of code: self.unet = self.core.compile_model(self._unet, device) There is error when compiling unet, with error "node input index is out of range". Does the error due to unsupported M1 CPU? Thanks.

bes-dev commented 1 year ago

@IPL no, this project doesn't work on Mac M1 CPU, only x86_64 compatible CPU

JanzenMark commented 1 year ago

@IPL By first installing the rust compiler with "brew install rust", then editing requirements.txt to delete the version number from numpy and switching openvino to openvino-arm I was able to get it to fully install on my M1. However, the diffusion is failing now due to lack of weights being installed. I haven't had time to debug that but hopefully this information helps you make progress on your system.

JustinGuese commented 1 year ago

even if it would work the speed would be horrible, as the m1 would emulate the x86_64 stuff

tfmoraes commented 1 year ago

@IPL and @JanzenMark see this https://replicate.com/blog/run-stable-diffusion-on-m1-mac

JanzenMark commented 1 year ago

Thanks @tfmoraes . Worked great! And fast too. Getting 1.5s / iteration.

ilya-lavrenov commented 1 year ago

@tfmoraes @IPL @JustinGuese you can try to use non-official OpenVINO ARM package https://pypi.org/project/openvino-arm with OpenVINO ARM plugin https://github.com/openvinotoolkit/openvino_contrib/tree/master/modules/arm_plugin underneath

zackees commented 1 year ago

If you are willing to run the docker version then try forcing docker to run in x86-64 emulation mode on the Mac M1:

Dockerfile:

Change

FROM python:3.9.9-bullseye

To

FROM --platform=linux/amd64 python:3.9.9-bullseye
ilya-lavrenov commented 1 year ago

Since OpenVINO 2022.3, pip openvino package is available natively for Apple M1 / M2 https://pypi.org/project/openvino/2022.3.0/#files

blinkguy182 commented 1 year ago

even if it would work the speed would be horrible, as the m1 would emulate the x86_64 stuff

M1 can emulate any x86 code as if it's nothing, I don't think that is an issue at all.