divamgupta / diffusionbee-stable-diffusion-ui

Diffusion Bee is the easiest way to run Stable Diffusion locally on your M1 Mac. Comes with a one-click installer. No dependencies or technical knowledge needed.
https://diffusionbee.com
GNU Affero General Public License v3.0
12.63k stars 630 forks source link

Can it support Intel chip x86 MacBook Pro? Thanks. #153

Open FreeBlues opened 2 years ago

FreeBlues commented 2 years ago

Can it support Intel chip x86 MacBook Pro? Thanks.

divamgupta commented 2 years ago

Yes! Check out the releases and let me know if it works or not.

ahhyeah commented 2 years ago

I installed the Intel version on a few different Macs and had a couple issues where I get an error that says, "Backend quit unexpectedly." It's working on an iMac Pro, not on an older Mac Pro and then it works on a couple MacBook Pros and not on another MacBook Pro. I thought they were all the same spec laptops so it's weird it doesn't work on one. What info can I share that would be helpful? Thanks! We're having fun as a family with this app! IMG_8526

ahhyeah commented 2 years ago

Update, after trying a few times of re-opening the app, it seems to be working... I also did some software updates on a couple and that helped those. The older Mac Pro is running High Sierra and it's working! 😂

ahhyeah commented 2 years ago

Curious, will there be a version 1.0 released for intel Macs?

FreeBlues commented 2 years ago

@divamgupta @ahhyeah Thanks for your response!

3 days before, I downloaded the 0.6.0 release, and found that it can not run on my MacBook Pro(2020 Intel CPU). The system said :"You can not open the Diffusion.app, because this Mac does not support the app". These days I tried several stable-diffusion repos to run on my MacBook Pro, and 2 of them succeed(only can be run on command line). Right now I downloaded the 1.0.0 release here, it can not work yet and got the same prompt. I think maybe in this App, only M1/M2'codes were built without Intel's.

Here is the repos I used, maybe be helpful for this project.

Install steps:

Install python3,version >=3.10

git clone -b apple-silicon-mps-support https://github.com/bfirsh/stable-diffusion.git macSD
cd macSD
mkdir -p models/ldm/stable-diffusion-v1/
ln -s ~/Github/sd-data/sd-v1-4.ckpt ./models/ldm/stable-diffusion-v1/model.ckpt

The sd-v1-4.ckpt need to be downloaded from Hugging Face repository, and saved into ~/Github/sd-data/sd-v1-4.ckpt

Setup python virtual env macenv

python3 -m pip install virtualenv
python3 -m virtualenv macenv

Activate virtualenv:macenv

source macenv/bin/activate

After activated, install the depends:

pip install -r requirements.txt 

All ok! use it in command line:

python scripts/txt2img.py \     
  --prompt "a red juicy apple floating in outer space, like a planet" \
  --n_samples 1 --n_iter 1 --plms --precision full
python scripts/img2img.py --prompt "A fantasy landscape, trending on artstation" --init-img <path-to-img.jpg> --strength 0.8

Follow this article:

https://github.com/invoke-ai/InvokeAI/blob/main/docs/installation/INSTALL_MAC.md

@ahhyeah I think your MacBook Pros must are all M1 chip.

ahhyeah commented 2 years ago

Diffusionbee 0.3.0 intel version is here on this github under "releases": https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/releases/download/0.3.0/DiffusionBee-0.3.0-intel-macos.dmg

FreeBlues commented 2 years ago

Diffusionbee 0.3.0 intel version is here on this github under "releases": https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/releases/download/0.3.0/DiffusionBee-0.3.0-intel-macos.dmg

Thanks a lot! It can work! very easy to use! Wish to update to the latest.

fortinmike commented 2 years ago

@divamgupta Any reason why versions >0.3.0 aren't compatible with Intel Macs? I tried running the app from source and nothing works, even text-to-image which worked fine before. It just generates a test image. I was looking forward to playing with image-to-image (and outpainting!) on my Intel MBP 16.

FreeBlues commented 2 years ago

@divamgupta Any reason why versions >0.3.0 aren't compatible with Intel Macs? I tried running the app from source and nothing works, even text-to-image which worked fine before. It just generates a test image. I was looking forward to playing with image-to-image (and outpainting!) on my Intel MBP 16.

We also look forward to continuing to support Intel CPU MacBookPro with the new version.

divamgupta commented 2 years ago

Yes! Check out the releases and let me know if it works or not.

On Thu, Sep 29, 2022 at 4:03 PM FreeBlues @.***> wrote:

Can it support Intel chip x86 MacBook Pro? Thanks.

— Reply to this email directly, view it on GitHub https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/issues/153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAONR5LG24SS6GMANKWW5HLWAYN3NANCNFSM6AAAAAAQZHIXDA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

peternoordijk commented 2 years ago

@divamgupta I did actually check the v1.0.0 arm64.dmg file last week on my intel macbook pro, just to be sure, but it obviously doesn't work. Meanwhile, there's also a new issue reported specifically for this https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/issues/182

fortinmike commented 2 years ago

@divamgupta Is this a mistake then? Were Intel builds disabled by mistake? Because all releases > 0.3.0 do not contain an Intel dmg. Only arm64.

fortinmike commented 2 years ago

Seems like the Intel build came back for 1.4.2 but was again removed in 1.4.3. @divamgupta mentioned issues with AMD GPUs which I assume might be part of the reason why the Intel build was removed again. Seems like the 1.4.2 build was set to use GPU even on AMD, which caused black images to be generated on my machine.

However, out of curiosity (and mostly because 0.3.0 worked fine on my Intel Mac with AMD GPU), I tried to build the app from source. To my surprise, it works just fine. It does run on the CPU, as before, but that's fine with me. Better than nothing.

To do the same on your machine, do the following:

  1. Install node.js 16.17.1 (LTS)
  2. Open Terminal, switch to the directory where you want the source to be downloaded cd ~/Downloads (for example) and run git clone https://github.com/divamgupta/diffusionbee-stable-diffusion-ui.git
  3. This one is a quick hack, but without time to research the source further, it works as a proof of concept. In the cloned source, open the electron_app/src/bridge.js file and replace line 16 (let script_path = ...) with this: let script_path = "../backends/stable_diffusion_tf/diffusionbee_backend.py"; (@divamgupta can you comment on the correct way to get rid of the fake backend and use the real one instead?)
  4. In Terminal, cd to the electron_app directory and run npm run electron:serve.

This will start the app, which AFAIK works just fine. I tried text-to-image, inpainting, image-to-image, etc. I did not encounter issues so far. So, why does the Intel build keep being removed? Are there some subtle issues which are deal-breakers on Intel hardware? I didn't notice any so far. It'd be great to be able to use official release builds instead of this workaround.

Screenshot 2022-10-29 at 11 18 56

divamgupta commented 2 years ago

Hey, thanks @fortinmike , would you be up for helping in getting the metal optimized version of Bee for AMD GPUs. could you email me at divamg@alumni.cmu.edu

sascha1337 commented 2 years ago

just need to change the deployment target to universal in xcode, maybe

fortinmike commented 2 years ago

@divamgupta Nice to hear you're working on a Metal version that could run on AMD GPUs! Code-wise, ML things are far from my area of expertise, though (if coding help is what you had in mind). I'm not sure I would be of much help on this front, but I can test alpha builds on my hardware if you don't have an Intel / AMD Mac on hand. I sent you an email.