Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Colab Error #2913

Open
Bob85111 opened this issue Aug 26, 2024 · 19 comments
Open

Google Colab Error #2913

Bob85111 opened this issue Aug 26, 2024 · 19 comments

Comments

@Bob85111
Copy link

Received the following error. Looks like somebody updated something, and now the code doesn't work anymore. Any ideas on how to fix it? Seems like this happens ever three or four months

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.3.0+cu121 with CUDA 1201 (you have 2.4.0+cu121)
Python 3.10.14 (you have 3.10.12)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details
ControlNet preprocessor location: /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
*** Error loading script: controlnet.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 515, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 16, in
import scripts.preprocessor as preprocessor_init # noqa
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/preprocessor/init.py", line 9, in
from .mobile_sam import *
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/preprocessor/mobile_sam.py", line 1, in
from annotator.mobile_sam import SamDetector_Aux
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/mobile_sam/init.py", line 12, in
from controlnet_aux import SamDetector
ModuleNotFoundError: No module named 'controlnet_aux'

@HaikenEdge
Copy link

HaikenEdge commented Aug 26, 2024

Can confirm this error, kinda. My version is this:

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.3.0+cu121 with CUDA 1201 (you have 2.4.0+cu121)
Python 3.10.14 (you have 3.10.12)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details

Not going to try a bunch of malware being pushed by bots.

@mdlieber99
Copy link

Same error here when trying to use dream booth:

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.3.0+cu121 with CUDA 1201 (you have 2.4.0+cu121)
Python 3.10.14 (you have 3.10.12)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details
Traceback (most recent call last):
File "/content/diffusers/examples/dreambooth/train_dreambooth.py", line 803, in
main()
File "/content/diffusers/examples/dreambooth/train_dreambooth.py", line 519, in main
unet.enable_xformers_memory_efficient_attention()

@morningbowlai
Copy link

Same issues here. Last time I had an issue like this, it got cleared up within a couple days. I tried to install that through the extension tab, but didn't fix anything,

@danixen2
Copy link

A quick fix to generate images and ignore this error is to remove --xformers at the end of the code line of the Start Stable-Diffusion tab.

Example:

try:
model
if os.path.isfile(model):
!python /content/gdrive/$mainpth/sd/stable-diffusion-w$blsaphemy/webui.py $share --api --disable-safe-unpickle --enable-insecure-extension-access --no-download-sd-model --no-half-vae --ckpt "$model" $auth --disable-console-progressbars --skip-version-check $ckptdir
else:
!python /content/gdrive/$mainpth/sd/stable-diffusion-w$blsaphemy/webui.py $share --api --disable-safe-unpickle --enable-insecure-extension-access --no-download-sd-model --no-half-vae --ckpt-dir "$model" $auth --disable-console-progressbars --skip-version-check
except:
!python /content/gdrive/$mainpth/sd/stable-diffusion-w$blsaphemy/webui.py $share --api --disable-safe-unpickle --enable-insecure-extension-access --no-download-sd-model --no-half-vae $auth --disable-console-progressbars --skip-version-check $ckptdir

@jalva00T
Copy link

Found from a discussion back in march that you can replace --xformers with --opt-sdp-attention. The interface loaded but its stuck trying to load the last prompt i had used.

@aifantasyglam
Copy link

to solve the issue run this: !pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121

@Azura-13
Copy link

Thank you aifantasyglam, that's perfect =)

@BlessedDuelOP
Copy link

love you aifantasyglam

@g-imconfused
Copy link

g-imconfused commented Aug 27, 2024

to solve the issue run this: !pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121

one question - where should this be run? somehwhere in the Install/Update AUTOMATIC1111 repo?

thanks all!

  • ok decided not to be lazy and instead answer my own question since i've never played with this code much.
    1- running this in my first choice, at the end of Install/Update AUTOMATIC1111 repo tossed few more errors from that cell but seemed to remove and reinstall xformers at the end. but still tossed the original error when starting SD, and choked in the UI. no luck

2 - next guess, running it in the requirements cell threw no errors after either cell, and UI is running back to normal - all good!

here's where i inserted it, in case it matters. this is the end of the code in the Requirements cell:

else:
%env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4

inserted line

!pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121

!pip install controlnet_aux -qq --no-deps
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ['PYTHONWARNINGS'] = 'ignore'
!sed -i 's@text = _formatwarnmsg(msg)@text =""@g' /usr/lib/python3.10/warnings.py

clear_output()
inf('\u2714 Done','success', '50px')

#@markdown ---

thanks as always!

@Azura-13
Copy link

Azura-13 commented Aug 27, 2024

I put it just above [6] Download Lora

Add Code, Copy and paste.

@aifantasyglam
Copy link

to solve the issue run this: !pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121

one question - where should this be run? somehwhere in the Install/Update AUTOMATIC1111 repo?

thanks all!

  • ok decided not to be lazy and instead answer my own question since i've never played with this code much.
    1- running this in my first choice, at the end of Install/Update AUTOMATIC1111 repo tossed few more errors from that cell but seemed to remove and reinstall xformers at the end. but still tossed the original error when starting SD, and choked in the UI. no luck

2 - next guess, running it in the requirements cell threw no errors after either cell, and UI is running back to normal - all good!

here's where i inserted it, in case it matters. this is the end of the code in the Requirements cell:

else: %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4

inserted line

!pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121

!pip install controlnet_aux -qq --no-deps os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' os.environ['PYTHONWARNINGS'] = 'ignore' !sed -i 's@text = _formatwarnmsg(msg)@text =""@g' /usr/lib/python3.10/warnings.py

clear_output() inf('\u2714 Done','success', '50px')

#@markdown ---

thanks as always!

I run it above this part

image

@aifantasyglam
Copy link

Everyone, I would like to take advantage of this thread and ask something

anyone knows how to solve this issue ?: Gourieff/sd-webui-reactor#483

@The-Great-Nothing
Copy link

The-Great-Nothing commented Aug 27, 2024

Same error here when trying to use dream booth:

WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.3.0+cu121 with CUDA 1201 (you have 2.4.0+cu121) Python 3.10.14 (you have 3.10.12) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Memory-efficient attention, SwiGLU, sparse and more won't be available. Set XFORMERS_MORE_DETAILS=1 for more details Traceback (most recent call last): File "/content/diffusers/examples/dreambooth/train_dreambooth.py", line 803, in main() File "/content/diffusers/examples/dreambooth/train_dreambooth.py", line 519, in main unet.enable_xformers_memory_efficient_attention()

FOr Dreambooth go to "Dependencies", show code and scroll down to the bottom of the code. Modify the last lines so you get something like this (note the added xformers install):

else:
    %env LD_PRELOAD=/content/gdrive/MyDrive/sd/libtcmalloc/libtcmalloc_minimal.so.4
    
!pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ['PYTHONWARNINGS'] = 'ignore'
!sed -i 's@raise AttributeError(f"module {module!r} has no attribute {name!r}")@@g' /usr/local/lib/python3.10/dist-packages/jax/_src/deprecations.py

@aifantasyglam
Copy link

Hi everyone, I got a new error related to the previous, does anyone know anything about it...?

image

@mdlieber99
Copy link

hmm, now the start up on the colab page is fine (with the extra line of code from aifantasyglam - thank you!). but now when I try to open the public url I get a '504 gateway time-out' error

@g-imconfused
Copy link

g-imconfused commented Aug 28, 2024 via email

@g-imconfused
Copy link

gradio back online now

@HappyRobotLtd
Copy link

Same issue here - Automatic 1111 was working fine in Colab on my MacBook Pro M1 until a few days ago and now this exact same xformers error which will launch the SD UI but delivers an error message when trying to generate anything.

Is there a simple fix for this that doesn't involve using the Terminal on a Mac that won't screw things up further?

(I can of course install SD in my local machine but it's very slow and eats up drive space and it doesn't require xformers to run properly.)

@Ratherman
Copy link

to solve the issue run this: !pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121

Notice that without running the command, Web UI could still be started up successfully.

Test Env: Google Colab, L4 GPU
Test Time: 2024/9/26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

16 participants