fast-stable-diffusion icon indicating copy to clipboard operation
fast-stable-diffusion copied to clipboard

Collab error - not working any more since today

Open MajorGruberth opened this issue 1 year ago • 53 comments

"WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.1.0+cu118 with CUDA 1106 (you have 2.1.0+cu121) Python 3.9.16 (you have 3.10.12) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)"

I would really like to work without interruptions like that. What does it mean? What do I have to do? For month I worked without much problems and suddenly this. How can I fix it? I am paying for Colab. What else can I do? Really p******!!

MajorGruberth avatar Dec 14 '23 19:12 MajorGruberth

Same here

DeAiArt avatar Dec 14 '23 19:12 DeAiArt

Probably a Python update. We might add manually a update with the old version of Python and Pytorch tho (https://download.pytorch.org/whl/cu118). I tried with a new environnement, but I get an error :(

D-usk avatar Dec 14 '23 19:12 D-usk

I tried the camenduru implementation - but that's another complete disaster

MajorGruberth avatar Dec 14 '23 19:12 MajorGruberth

I tried this:

!pip install lmdb !pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 torchtext==0.15.2+cpu torchdata==0.6.1 --index-url https://download.pytorch.org/whl/cu118

was a tip from an old post from October. But it doesn't help either....

DeAiArt avatar Dec 14 '23 19:12 DeAiArt

thanks for cheering me up :)

MajorGruberth avatar Dec 14 '23 19:12 MajorGruberth

I'm giving up for tonight. Thing is: I want to pay for a valuable product. I have no unpaid apps on my computer nor my phone. I just need stuff that works. But SD is more and more like my experiences in coding in the late 80s of the last century: might work, might not. Dall-E is not flexible enough for me. Midnight Journet e.a. same. ComfyUI doesn't have a proper notebook and takes some time to get adjust. SD Next doesn't care about cloud computing (and not about MacOs anyway). So: even I would spend some $$ for an undisturbed uncluttered workflow: I CANT'T :-(

MajorGruberth avatar Dec 14 '23 19:12 MajorGruberth

Can confirm, stopped working between when I left for work and when I came back. Same error.

HaikenEdge avatar Dec 14 '23 19:12 HaikenEdge

In my environment, I added the following code to the beginning of the notebook and ran it, and StableDiffusion ran as before. I also made some modifications to the October Tips: [https://github.com/TheLastBen/fast-stable-diffusion/issues/2615]

!pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118

aegia13 avatar Dec 14 '23 21:12 aegia13

In my environment, I added the following code to the beginning of the notebook and ran it, and StableDiffusion ran as before. I also made some modifications to the October Tips: [https://github.com//issues/2615]

!pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118

You are my personal hero. But you always have to run the script again when you have finished the runtime.

DeAiArt avatar Dec 14 '23 21:12 DeAiArt

@aegia13 you are officially the internet first on this one. Havent used my SD colab for a month, been googling this issue for two hours no luck. Finally realized to try here, you'd posted the fix less than 30min earlier. Total gratitude here.

jppetersen10 avatar Dec 14 '23 21:12 jppetersen10

@aegia13

Ok, somebody buy this man a beer! Cheers :)

Gelazer avatar Dec 15 '23 00:12 Gelazer

sorry to say when i use highres.fix,it could not work either...

Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 36, in f
    res = func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py", line 55, in txt2img
    processed = processing.process_images(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 732, in process_images
    res = process_images_inner(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 867, in process_images_inner
    samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 1156, in sample
    return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 1242, in sample_hr_pass
    samples = self.sampler.sample_img2img(self, samples, noise, self.hr_c, self.hr_uc, steps=self.hr_second_pass_steps or self.steps, image_conditioning=image_conditioning)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 145, in sample_img2img
    sigma_sched = sigmas[steps - t_enc - 1:]
TypeError: slice indices must be integers or None or have an __index__ method

yanfma123 avatar Dec 15 '23 04:12 yanfma123

I'm also having this problem today

Talionic avatar Dec 15 '23 07:12 Talionic

sorry to say when i use highres.fix,it could not work either...

Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 36, in f
    res = func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py", line 55, in txt2img
    processed = processing.process_images(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 732, in process_images
    res = process_images_inner(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 867, in process_images_inner
    samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 1156, in sample
    return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 1242, in sample_hr_pass
    samples = self.sampler.sample_img2img(self, samples, noise, self.hr_c, self.hr_uc, steps=self.hr_second_pass_steps or self.steps, image_conditioning=image_conditioning)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 145, in sample_img2img
    sigma_sched = sigmas[steps - t_enc - 1:]
TypeError: slice indices must be integers or None or have an __index__ method

Hires.fix work's fine for me

DeAiArt avatar Dec 15 '23 07:12 DeAiArt

!pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118

sadly it doesnt work today for some reason, getting some cuda setup failed error

gimpycpu avatar Dec 15 '23 10:12 gimpycpu

I added this in the requirements section, and it's working for me (it's a fix from Xela for his notebook apparently this is an error caused by colab env updates)

!pip install https://download.pytorch.org/whl/cu121/xformers-0.0.22.post4-cp310-cp310-manylinux2014_x86_64.whl#sha256=7075114dbf698b609b599f0d35032c0b2f9a389751e8bbf4dd3c628376b0dd9c

Saranmt avatar Dec 15 '23 11:12 Saranmt

Tried all the above approaches, still getting the error, for CUDA setup.

CUDA SETUP: Setup Failed!

@Saranmt @HaikenEdge @bladewolf74 @TheLastBen anyone came up with any solution?

Screenshot 2023-12-15 at 5 16 46 PM

yashveer08 avatar Dec 15 '23 11:12 yashveer08

Not sure if this helps, but this is my current working Requirements section, tho I have to erase runtime, refresh and run from scratch all cells on each batch I run, so it's not the best fix, I'd say a temporary one:

#@markdown # Requirements

print('[1;32mInstalling requirements...')

with capture.capture_output() as cap:
  %cd /content/
  !wget -q -i https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/Dependencies/A1111.txt
  !dpkg -i *.deb
  if not os.path.exists('/content/gdrive/'+mainpth+'/sd/stablediffusiond'): #restore later
    !tar -C /content/gdrive/$mainpth --zstd -xf sd_mrep.tar.zst
  !tar -C / --zstd -xf gcolabdeps.tar.zst
  !rm *.deb | rm *.zst | rm *.txt
  if not os.path.exists('gdrive/'+mainpth+'/sd/libtcmalloc/libtcmalloc_minimal.so.4'):
    %env CXXFLAGS=-std=c++14
    !wget -q https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz && tar zxf gperftools-2.5.tar.gz && mv gperftools-2.5 gperftools
    !wget -q https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/Patch
    %cd /content/gperftools
    !patch -p1 < /content/Patch
    !./configure --enable-minimal --enable-libunwind --enable-frame-pointers --enable-dynamic-sized-delete-support --enable-sized-delete --enable-emergency-malloc; make -j4
    !mkdir -p /content/gdrive/$mainpth/sd/libtcmalloc && cp .libs/libtcmalloc*.so* /content/gdrive/$mainpth/sd/libtcmalloc
    %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4
    %cd /content
    !rm *.tar.gz Patch && rm -r /content/gperftools
  else:
    %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4

  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
  !pip install open-clip-torch==2.20.0 -qq --no-deps
  !pip install fastapi==0.94.0 gradio==3.41.2 -qq
  !pip install lmdb
  !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu121
  !pip install https://download.pytorch.org/whl/cu121/xformers-0.0.22.post4-cp310-cp310-manylinux2014_x86_64.whl#sha256=7075114dbf698b609b599f0d35032c0b2f9a389751e8bbf4dd3c628376b0dd9c
clear_output()
inf('\u2714 Done','success', '50px')

#@markdown ---

Saranmt avatar Dec 15 '23 12:12 Saranmt

Not sure if this helps, but this is my current working Requirements section, tho I have to erase runtime, refresh and run from scratch all cells on each batch I run, so it's not the best fix, I'd say a temporary one:

#@markdown # Requirements

print('�[1;32mInstalling requirements...')

with capture.capture_output() as cap:
  %cd /content/
  !wget -q -i https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/Dependencies/A1111.txt
  !dpkg -i *.deb
  if not os.path.exists('/content/gdrive/'+mainpth+'/sd/stablediffusiond'): #restore later
    !tar -C /content/gdrive/$mainpth --zstd -xf sd_mrep.tar.zst
  !tar -C / --zstd -xf gcolabdeps.tar.zst
  !rm *.deb | rm *.zst | rm *.txt
  if not os.path.exists('gdrive/'+mainpth+'/sd/libtcmalloc/libtcmalloc_minimal.so.4'):
    %env CXXFLAGS=-std=c++14
    !wget -q https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz && tar zxf gperftools-2.5.tar.gz && mv gperftools-2.5 gperftools
    !wget -q https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/Patch
    %cd /content/gperftools
    !patch -p1 < /content/Patch
    !./configure --enable-minimal --enable-libunwind --enable-frame-pointers --enable-dynamic-sized-delete-support --enable-sized-delete --enable-emergency-malloc; make -j4
    !mkdir -p /content/gdrive/$mainpth/sd/libtcmalloc && cp .libs/libtcmalloc*.so* /content/gdrive/$mainpth/sd/libtcmalloc
    %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4
    %cd /content
    !rm *.tar.gz Patch && rm -r /content/gperftools
  else:
    %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4

  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
  !pip install open-clip-torch==2.20.0 -qq --no-deps
  !pip install fastapi==0.94.0 gradio==3.41.2 -qq
  !pip install lmdb
  !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu121
  !pip install https://download.pytorch.org/whl/cu121/xformers-0.0.22.post4-cp310-cp310-manylinux2014_x86_64.whl#sha256=7075114dbf698b609b599f0d35032c0b2f9a389751e8bbf4dd3c628376b0dd9c
clear_output()
inf('\u2714 Done','success', '50px')

#@markdown ---

There is a variable mainpth that you are using. what is it?

What are the libraries or import command that you added can you highlight that.

Also what do you mean by temporary fix?

yashveer08 avatar Dec 15 '23 12:12 yashveer08

Not sure if this helps, but this is my current working Requirements section, tho I have to erase runtime, refresh and run from scratch all cells on each batch I run, so it's not the best fix, I'd say a temporary one:

#@markdown # Requirements

print('�[1;32mInstalling requirements...')

with capture.capture_output() as cap:
  %cd /content/
  !wget -q -i https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/Dependencies/A1111.txt
  !dpkg -i *.deb
  if not os.path.exists('/content/gdrive/'+mainpth+'/sd/stablediffusiond'): #restore later
    !tar -C /content/gdrive/$mainpth --zstd -xf sd_mrep.tar.zst
  !tar -C / --zstd -xf gcolabdeps.tar.zst
  !rm *.deb | rm *.zst | rm *.txt
  if not os.path.exists('gdrive/'+mainpth+'/sd/libtcmalloc/libtcmalloc_minimal.so.4'):
    %env CXXFLAGS=-std=c++14
    !wget -q https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz && tar zxf gperftools-2.5.tar.gz && mv gperftools-2.5 gperftools
    !wget -q https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/Patch
    %cd /content/gperftools
    !patch -p1 < /content/Patch
    !./configure --enable-minimal --enable-libunwind --enable-frame-pointers --enable-dynamic-sized-delete-support --enable-sized-delete --enable-emergency-malloc; make -j4
    !mkdir -p /content/gdrive/$mainpth/sd/libtcmalloc && cp .libs/libtcmalloc*.so* /content/gdrive/$mainpth/sd/libtcmalloc
    %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4
    %cd /content
    !rm *.tar.gz Patch && rm -r /content/gperftools
  else:
    %env LD_PRELOAD=/content/gdrive/$mainpth/sd/libtcmalloc/libtcmalloc_minimal.so.4

  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
  !pip install open-clip-torch==2.20.0 -qq --no-deps
  !pip install fastapi==0.94.0 gradio==3.41.2 -qq
  !pip install lmdb
  !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu121
  !pip install https://download.pytorch.org/whl/cu121/xformers-0.0.22.post4-cp310-cp310-manylinux2014_x86_64.whl#sha256=7075114dbf698b609b599f0d35032c0b2f9a389751e8bbf4dd3c628376b0dd9c
clear_output()
inf('\u2714 Done','success', '50px')

#@markdown ---

There is a variable mainpth that you are using. what is it?

What are the libraries or import command that you added can you highlight that.

Also what do you mean by temporary fix?

the main path is in the original Automatic1111 I didnt change anything and have no idea what it does, the only part I added was this: !pip install https://download.pytorch.org/whl/cu121/xformers-0.0.22.post4-cp310-cp310-manylinux2014_x86_64.whl#sha256=7075114dbf698b609b599f0d35032c0b2f9a389751e8bbf4dd3c628376b0dd9c

,,, by temporary fix , I mean this is not a good fix since I have to rerun it from scratch everytime, hopefully someone comes up with a better solution

Saranmt avatar Dec 15 '23 12:12 Saranmt

In my environment, I added the following code to the beginning of the notebook and ran it, and StableDiffusion ran as before. I also made some modifications to the October Tips: [https://github.com//issues/2615]

!pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118

after testing a while I have to say: It worked for me. Thanks aegia13, saves my day :-)

MajorGruberth avatar Dec 15 '23 12:12 MajorGruberth

ng a while I @MajorGruberth Can you share me how it worked for you? Also if you could share the colab file it would be great.

yashveer08 avatar Dec 15 '23 12:12 yashveer08

In my environment, I added the following code to the beginning of the notebook and ran it, and StableDiffusion ran as before. I also made some modifications to the October Tips: [https://github.com//issues/2615] !pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118

after testing a while I have to say: It worked for me. Thanks aegia13, saves my day :-)

just to clarify were you using fast-dreambooth or fast-stable_diffusion it doesnt seem to work with the former but I just want to confirm

gimpycpu avatar Dec 15 '23 12:12 gimpycpu

!pip uninstall xformers
!pip uninstall torch

!pip install xformers
!pip install torch

solves it for me in other projects as well

https://colab.research.google.com/drive/17A41komGbvrhY-0mNFd-ZuNQKNONXGdp?usp=sharing

0xlws avatar Dec 15 '23 13:12 0xlws

What is worse is that is a general error. The colab version of Kohya trainer also stopped working.

ClaraSanders avatar Dec 15 '23 13:12 ClaraSanders

What is worse is that is a general error. The colab version of Kohya trainer also stopped working.

Yeah it maybe because of the colab version upgrade or some package library upgrade. But need solution if anyone comes up with.

yashveer08 avatar Dec 15 '23 13:12 yashveer08

ng a while I @MajorGruberth Can you share me how it worked for you? Also if you could share the colab file it would be great.

Certainly. I modified the first part of the notebook, "Connect Google Drive" and it looks like:


#@markdown # Connect Google Drive !pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118 from google.colab import drive from IPython.display import clear_output import ipywidgets as widgets import os

def inf(msg, style, wdth): inf = widgets.Button(description=msg, disabled=True, button_style=style, layout=widgets.Layout(min_width=wdth));display(inf) Shared_Drive = "" #@param {type:"string"} #@markdown - Leave empty if you're not using a shared drive

print("[0;33mConnecting...") drive.mount('/content/gdrive')

if Shared_Drive!="" and os.path.exists("/content/gdrive/Shareddrives"): mainpth="Shareddrives/"+Shared_Drive else: mainpth="MyDrive"

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

#@markdown ---


with other words you click "show code" and paste in:

!pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118

than start the notebook

MajorGruberth avatar Dec 15 '23 13:12 MajorGruberth

What is worse is that is a general error. The colab version of Kohya trainer also stopped working.

https://github.com/TheLastBen/fast-stable-diffusion/issues/2681#issuecomment-1857881050 , should be a (temporary) general solution

0xlws avatar Dec 15 '23 13:12 0xlws

What is worse is that is a general error. The colab version of Kohya trainer also stopped working.

#2681 (comment) , should be a (temporary) general solution

Just this did not worked.

It showed Exception: CUDA SETUP: Setup Failed!

Screenshot 2023-12-15 at 7 46 03 PM

yashveer08 avatar Dec 15 '23 14:12 yashveer08

I just added 'xformers' also at the end and now it works (wasn't the case without it):

#@markdown # Connect Google Drive !pip install lmdb !pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118 xformers

benoit-roubert avatar Dec 15 '23 16:12 benoit-roubert