camenduru / stable-diffusion-webui-colab

stable diffusion webui colab
The Unlicense
15.58k stars 2.61k forks source link

🚨 Why is Colab Disconnecting? #405

Open camenduru opened 1 year ago

camenduru commented 1 year ago

According to the official statement, the Colab Free tier is not available for the Stable Diffusion WebUI 😭. We can only use it with a paid plan.

If you have more questions, please ask here: https://github.com/googlecolab/colabtools/issues

1Zero11 commented 1 year ago

Yeah... seems like they've started to enforce it

zaviier commented 1 year ago

some Colab still can use it.. just remove/rename stable-diffusion thing to another name. and it's solved

romper-pain commented 1 year ago

are there any sort of workarounds for this? renaming the project, having an alternate disguised version, or any free colab alternatives or whatnot?

etherealxx commented 1 year ago

some Colab still can use it.. just remove/rename stable-diffusion thing to another name. and it's solved

camenduru can't just do that, i think. All eyes are on his colab. Colab team can figure out the better solution to even banning more strictly. At this point just be chill with the 'safe' colab.

etherealxx commented 1 year ago

are there any sort of workarounds for this? renaming the project, having an alternate disguised version, or any free colab alternatives or whatnot?

There are many that claims 'still safe', check out here: https://github.com/camenduru/stable-diffusion-webui-colab/tree/community

DevRushi-engg commented 1 year ago

some Colab still can use it.. just remove/rename stable-diffusion thing to another name. and it's solved

But how to do that from where to remove it

DevRushi-engg commented 1 year ago

https://github.com/camenduru/stable-diffusion-webui-colab/issues/407 What about this thing

mike59881051 commented 1 year ago

Is it just webUI is banned or stable diffusion altogether?

mcube-12139 commented 1 year ago

Rename "stable diffusion" to "erratic condensation"

bincooo commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2

Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

gabrielsmecrow commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2

Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

works for me

tralala87 commented 1 year ago

It doesn't work for me:

`Status Legend: (OK):download completed. Exception: [AbstractOptionHandler.cc:69] errorCode=28 We encountered a problem while processing the option '--continue'. -> [OptionHandlerImpl.cc:95] errorCode=1 continue must be either 'true' or 'false'. Usage: -c, --continue[=true|false] Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to http(s)/ftp downloads.

                          Possible Values: true, false
                          Default: false
                          Tags: #basic, #http, #ftp

sed: can't read /content//launch.pyi: No such file or directory sed: can't read /content//launch.py: No such file or directory sed: can't read /content//modules/shared.py: No such file or directory python3: can't open file '/content/stable-diffusion-webui/launch.py': [Errno 2] No such file or directory`

SEYED1424 commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2

Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

wich stable-diffusion-webui? because some of them are related to web URLs and others are related to local directories.

vicentefelipechile commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2

Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

What header?

DeekshithSH commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2

Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

why encoding and decoding when it can be done something like this https://github.com/DeekshithSH/Automatic-1111-WebUI-Colab/blob/main/controlnet.ipynb

bincooo commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2 Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

why encoding and decoding when it can be done something like this https://github.com/DeekshithSH/Automatic-1111-WebUI-Colab/blob/main/controlnet.ipynb

ofcourse, as long as you achieve the purpose of blocking keywords

Sarthak-999 commented 1 year ago

Hi there,I am not a coder but need to use stable diffusion for free if possible can anyone please figure out about this

Step1 Append code in header:

import sys import os import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii') sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2

Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

I understood the second step that by going on edit we can replace it but can anyone please tell me about how to do the first step it would be really helpful for me,thank you for reading.

DeekshithSH commented 1 year ago

Just paste the code

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

In top of the code

Sarthak-999 commented 1 year ago

Do we have to make a new cell or on the top of first cell?,thank you soo much for replying.

DeekshithSH commented 1 year ago

Do we have to make a new cell or on the top of first cell?,thank you soo much for replying.

On top of existing cell(first cell)

timtensor commented 1 year ago

Hi , can you share the colab notebook or snippet where you actually make the changes ? That would be of great help

DeekshithSH commented 1 year ago

Hi , can you share the colab notebook or snippet where you actually make the changes ? That would be of great help

Here is a modified notebook files This and This Don't know this still works or not You can reference this file but it's little bit different than what trick your trying to ask

LIMPIX31 commented 1 year ago

@DeekshithSH

Thank you! That's working fine!

While I still have issues with the SD itself, they are not colab related and are easy to fix.

If you load your model, remember to also replace all occurrences of stable as well

omensight commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2 Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

works for me

This is joy, will try it after work, Love this project. Thank you so much.

zaviier commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2 Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

works for me

This is joy, will try it after work, Love this project. Thank you so much.

is this still worked?

loboere commented 1 year ago

@bincooo Can you make a colab that has this code in the right place, I don't know where to put it.

zaviier commented 1 year ago

@bincooo Can you make a colab that has this code in the right place, I don't know where to put it.

this does not work anymore. I already tested

SixSiege commented 1 year ago

Alright, so apparently "diffusion" is the new blocked word. I tried changing "diffusion" to {d} and adding d="diffusion" on top of the cell and it works

SysGang commented 1 year ago

Alright, so apparently "diffusion" is the new blocked word. I tried changing "diffusion" to {d} and adding d="diffusion" on top of the cell and it works

How can I implement this? Can you give maybe a step-by-step tutorial? Thanks.

zaviier commented 1 year ago

Alright, so apparently "diffusion" is the new blocked word. I tried changing "diffusion" to {d} and adding d="diffusion" on top of the cell and it works

nope. still disconnected

possom2009 commented 1 year ago

Is there a version without webui? That's what's banned, a non webui version should work ok.

upright2003 commented 1 year ago

I can test diffusion that day, but it won’t work tomorrow. Is there a way to generate an image using the following command??

python scripts/txt2img.py --prompt "YOUR-PROMPT-HERE" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1

https://www.assemblyai.com/blog/how-to-run-stable-diffusion-locally-to-generate-images/

kawasaki-koto commented 1 year ago

I made a copy of it in a private git repository and removed "webui" and used it. It worked fine for the last few days, but now it doesn't work. It is very likely that colab has set up a ban word other than "webui".

Vector-Stack commented 1 year ago

it's the problem of "diffusion".

gustavokch commented 1 year ago

Step1 Append code in header:

import sys
import os
import base64

w = base64.b64decode(("d2VidWk=").encode('ascii')).decode('ascii')
sdw = base64.b64decode(("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode('ascii')).decode('ascii')

Step2 Replace all stable-diffusion-webui characters with $sdw Replace all webui characters with $w

works for me

This is joy, will try it after work, Love this project. Thank you so much.

is this still worked?

New step 1 trick:

add the following to first cell

!pip install pycryptodome pycryptodomex
import sys
import os

from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes

key = b'\x7f\xb0\xe2\xd6\xdf\xad\xc5S\x1f\x1b\x141\x9f\x1b\x08\x99'
nonce = b'(\xfd\xfd\xc4\x04\xff\x9d\xc5\xe6\xc8.\x8b\xaf>\xb4\xe6'
tag = b'\x11\xd6`\xf77\xeb\x1dq\xb9\x19l,\x83\x08,\xb1'
ciphertext = b'\xcc\xbeb\x0bH'
cipher = AES.new(key, AES.MODE_EAX, nonce)
data = cipher.decrypt_and_verify(ciphertext, tag)

data = str(data)
data = data.replace("b'", "")
data = data.replace("'", "")
print(data)
w = data

key = b'\xdeO\xbd\xa7G\xda\x85b\xba\x15f6\x8b\xc5\xc8\x17'
nonce = b'j\x1d]\xf4\xc2\x91\xed\xc4\x96=\xb2C\xe5\xf3\xaa2'
tag = b'\xc3\xce\xd2M\x1b\x19\xed\xee\xc1\x94?01O\nX'
ciphertext = b'\x86\x89\xbd3P8\xc4\xccA\xdeQ*\x10k0\xe1\xb2<T\xed\x95\xf3'

cipher = AES.new(key, AES.MODE_EAX, nonce)
data2 = cipher.decrypt_and_verify(ciphertext, tag)

data2 = str(data2)
data2 = data2.replace("b'", "")
data2 = data2.replace("'", "")
print(data2)
sdw = data2
gustavokch commented 1 year ago

here is a working notebook file wui.zip EDIT: sometimes it disconnects...

gustavokch commented 1 year ago

My working notebook that supports model loading from huggingface or civitai, loras, long prompts and (IMO) the best upscaling algorithms, without web UI.

If you want to use a GDrive that is not the same as the account logged in on colab, setup rclone and select that option sd_gpu_upscaling.zip

gustavokch commented 1 year ago

ALSO, this GUI works fine on colab free, even though for some reason the results are kind of lo-fi: https://github.com/camenduru/InvokeAI-colab/blob/main/InvokeAI_colab.ipynb

another option using TPU instances for crazy fast inference: stable_diffusion_jax_clean.zip

upright2003 commented 1 year ago

ALSO, this GUI works fine on colab free, even though for some reason the results are kind of lo-fi: https://github.com/camenduru/InvokeAI-colab/blob/main/InvokeAI_colab.ipynb

another option using TPU instances for crazy fast inference: stable_diffusion_jax_clean.zip

stable_diffusion_jax_clean.zip stable_diffusion_jax_clean.ipynb This ipynb file cannot be opened, there is an error

gustavokch commented 1 year ago

Please speak english if you wan't help, use a translator if you need one. What error are you getting?

Set runtime to TPU.

Make sure to use native Gdrive if you don't have rclone setup, and fill in the huggingface token. The rclone option is only there in case you want to use Google Drive from another account.

Otherwise, just read the code and the error message, read the documentation on hugging face hub and try to fix it.

upright2003 commented 1 year ago

Please speak english if you wan't help, use a translator if you need one. What error are you getting?

Set runtime to TPU.

Make sure to use native Gdrive if you don't have rclone setup, and fill in the huggingface token. The rclone option is only there in case you want to use Google Drive from another account.

Otherwise, just read the code and the error message, read the documentation on hugging face hub and try to fix it.

I am sorry. stable_diffusion_jax_clean.zip stable_diffusion_jax_clean.ipynb This ipynb file cannot be opened, there is an error https://i.imgur.com/9mlbTLu.png Notebook loading error The file is corrupted or is not a valid notebook file.

ParikhKadam commented 1 year ago

Let's shift this chat to a discord / telegram. Google might be spying on us -_-

gustavokch commented 1 year ago

ALSO, this GUI works fine on colab free, even though for some reason the results are kind of lo-fi: https://github.com/camenduru/InvokeAI-colab/blob/main/InvokeAI_colab.ipynb another option using TPU insta stable_diffusion_jax_clean_fix.zip nces for crazy fast inference: stable_diffusion_jax_clean.zip

stable_diffusion_jax_clean.zip stable_diffusion_jax_clean.ipynb This ipynb file cannot be opened, there is an error

My bad... Here is the fix. stable_diffusion_jax_clean_fix.zip

gustavokch commented 1 year ago

Let's shift this chat to a discord / telegram. Google might be spying on us -_-

OK... DM me with details.

The way I see it, Google is not against running stable diffusion itself, but rather the popular GUIs, and they're mostly enforcing it through string detection, or perhaps by dumping running processes and comparing to known hashes of files in such GUIs. Nor diffusion, diffusers, neither stable-diffusion, gradio or stablediffusion are specifically banned strings.

For banned strings you can always encrypt them using something like AES with random keys, the problem with running the full stable-diffusion-webui is most likely the strings inside the repo files which there is no way to replace statically without breaking the code somewhere else.

I haven't really dug into this much, but if there way some way to trace the execution while printing the last line executed by the interpreter, it would be possible to circumvent the restriction, but it won't be an easy task. Maybe using cython or numba jit could work. Or writing a wrapper for the python executable in a more performant language that encrypts memory dynamically.

I'm not that crazy about using GUIs to consider such work atm, solutions can be made from scratch using native jupyter without ever needing to run a web server or code from banned popular implementations.

ParikhKadam commented 12 months ago

@gustavokch how do I reach out?

DuckytheQuack commented 11 months ago

@gustavokch @ParikhKadam I made a discord server where we can discuss it further. I also have some ideas for getting around the block.

Discord server invite base64: aHR0cHM6Ly9kaXNjb3JkLmdnL3NzYTVYRTVycg==

If you'd prefer it be a telegram just let me know