diffusionbee-stable-diffusion-ui icon indicating copy to clipboard operation
diffusionbee-stable-diffusion-ui copied to clipboard

Supplied `build.sh` builds for CPU only and ignores GPU

Open stable-duck opened this issue 2 years ago • 2 comments

Below is the steps I've executed, on a clean MacOS install with Xcode developer tools and Homebrew. python3 refers to Python 3.10.7, downloaded from Python.org. Not using Conda/Anaconda.

git clone https://github.com/divamgupta/diffusionbee-stable-diffusion-ui
cd diffusionbee-stable-diffusion-ui/backends/stable_diffusion_tf
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements_m1.txt
python3 -m pip install pyinstaller
sh build.sh

Snippets from output:

422 WARNING: Unable to copy metadata for tensorflow: The 'tensorflow' distribution was not found and is required by the application
...
21557 WARNING: Unable to determine requirements for tensorflow: The 'tensorflow' distribution was not found and is required by the application
21562 WARNING: Unable to copy metadata for tensorflow-plugins: The 'tensorflow-plugins' distribution was not found and is required by the application
21667 WARNING: Unable to determine requirements for tensorflow-plugins: The 'tensorflow-plugins' distribution was not found and is required by the application
...
62622 INFO: Analyzing hidden import 'tensorflow.__internal__'
62622 ERROR: Hidden import 'tensorflow.__internal__' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.autograph'
62622 ERROR: Hidden import 'tensorflow.__internal__.autograph' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.decorator'
62622 ERROR: Hidden import 'tensorflow.__internal__.decorator' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.dispatch'
62622 ERROR: Hidden import 'tensorflow.__internal__.dispatch' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.distribute'
62622 ERROR: Hidden import 'tensorflow.__internal__.distribute' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.distribute.combinations'
62622 ERROR: Hidden import 'tensorflow.__internal__.distribute.combinations' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.distribute.interim'
62622 ERROR: Hidden import 'tensorflow.__internal__.distribute.interim' not found
62622 INFO: Analyzing hidden import 'tensorflow.__internal__.distribute.multi_process_runner'
62623 ERROR: Hidden import 'tensorflow.__internal__.distribute.multi_process_runner' not found
62623 INFO: Analyzing hidden import 'tensorflow.__internal__.eager_context'
62623 ERROR: Hidden import 'tensorflow.__internal__.eager_context' not found
...
(hundreds of similar lines)
...
PyInstaller.utils.osx.IncompatibleBinaryArchError: /Users/samuel/git/diffusionbee-stable-diffusion-ui/backends/stable_diffusion_tf/venv/lib/python3.10/site-packages/google/protobuf/pyext/_message.cpython-310-darwin.so is incompatible with target arch arm64 (has arch: x86_64)!

The final error looks to be caused by the default version of protobuf from PIP being built for x86, so I replace it with one built from source:

python3 -m pip uninstall protobuf
python3 -m pip install --no-binary :all: protobuf==3.19.4 --ignore-installed

and re-run: sh build.sh

This time I get a binary. But when testing the binary - by starting it in terminal and using the test prompt:

b2py t2im {"prompt":"cat"}

It logs out that it's using CPU, not GPU, and is ~5x slower than the provided binary in the repo - i.e. 5.5s/it instead of 1s/it.

Any ideas anyone? This is blocking many people from contributing to the project.

stable-duck avatar Oct 03 '22 17:10 stable-duck

Using an environment set up using Anaconda and Python 3.9, the produced binary also uses the CPU instead of the GPU when using the "b2py t2im" command (~5s/it instead of 1s/it when using the election GUI).

whab avatar Oct 06 '22 04:10 whab

Starting to wonder whether anyone other than the @divamgupta has been able to build properly at all. been wanting to contribute for weeks now, I know it's not fun to write build documentation, but I really think it would help the community if there's an actual way to build this repository for anyone other than the original creator.

I had this same issue as well as other issues I still couldn't find an answer to (from this thread https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/issues/62)

Just making it easy for people to build will accelerate the development exponentially.

polaski avatar Oct 07 '22 01:10 polaski

I have also been wanting to contribute and have succeeded in building the app a few months ago but I had to make a couple of temporary modifications to the backend for it to work. It was clearly not the way it was supposed to be built but it worked for some quick experimentation.

I'd love to have official instructions to setup a development environment / proper build for DiffusionBee. I'm thinking of contributing a few bug fixes at first but I have some other things in mind (mostly small but nice UX tweaks and features) that I'm sure a lot of people would appreciate.

fortinmike avatar May 05 '23 18:05 fortinmike