TheLastBen / fast-stable-diffusion

fast-stable-diffusion + DreamBooth
MIT License
7.49k stars 1.3k forks source link

SD Dynamic Prompts Extensions doesn't work #333

Open kvietcong opened 1 year ago

kvietcong commented 1 year ago

https://github.com/adieyal/sd-dynamic-prompts this extension doesn't work properly with the AUTOMATIC1111 web ui notebook. It can't load the script and I believe it's because the notebook uses python 3.7. Is there a way to use this extension or update the python version?

I was able to use this snippet to get Python 3.10

#@markdown # Update to Python 3.10
from IPython.utils import io

with io.capture_output() as _:
  !sudo add-apt-repository ppa:deadsnakes/ppa -y
  !sudo apt update -y

  !sudo apt install python3.10 -y

  !sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 5
  !sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 5

  !curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10

!python --version

It works with a manual cloning of AUTOMATIC's webui. However, I can't get xformers to work on that so I was wondering if there was a fix for this notebook. (Or if you know how to get xformers to work I'd appreciate that too) Thanks!

TheLastBen commented 1 year ago

A different version of python would mean recompiling xformers for all the supported GPUs, that is on the to do list.

kvietcong commented 1 year ago

Ah I see, should I just close this issue then?

TheLastBen commented 1 year ago

keep it open, we'll use it to ask contributors to provide pre-compiled files for the new python version

kvietcong commented 1 year ago

Do you have a link to a tutorial for pre-compiling xformers? I could take a shot at it but if not, I could wait.

TheLastBen commented 1 year ago

run :

!pip install git+https://github.com/facebookresearch/xformers@51dd119#egg=xformers

after around 50min, and the installation is done, navigate to /usr/local/lib/python3.10/dist-packages/xformers

save the two files : "_C_flashattention.so" and "_C.so", upload them to any host and send me the link and I will integrate them.

the files might not show in the colab explorer, so you will have to rename them

!cp /usr/local/lib/python3.10/dist-packages/xformers/_C.so /usr/local/lib/python3.10/dist-packages/xformers/C.py

!cp /usr/local/lib/python3.10/dist-packages/xformers/_C_flashattention.so /usr/local/lib/python3.10/dist-packages/xformers/C_flashattention.py
kvietcong commented 1 year ago

It seems like running pip install doesn't work. Here is the output:

Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting xformers
  Cloning https://github.com/facebookresearch/xformers (to revision 51dd119) to /tmp/pip-install-h5wv2l8s/xformers_88043ec6312243359ba5caa291a06227
  Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/xformers /tmp/pip-install-h5wv2l8s/xformers_88043ec6312243359ba5caa291a06227
  WARNING: Did not find branch or tag '51dd119', assuming revision or ref.
  Running command git checkout -q 51dd119
  Resolved https://github.com/facebookresearch/xformers to commit 51dd119
  Running command git submodule update --init --recursive -q
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Also if it helps, my nvidia-smi output

Thu Nov  3 04:33:42 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.32.03    Driver Version: 460.32.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
| N/A   36C    P8     9W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+