TheLastBen / fast-stable-diffusion

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

Error when trying to run notebook all of a sudden #768

Open dillfrescott opened 1 year ago

dillfrescott commented 1 year ago
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-12-55b102f3c5f0>](https://localhost:8080/#) in <module>
     44 if Use_Gradio_Server:
     45   share='--share'
---> 46   for line in fileinput.input('/usr/local/lib/python3.7/dist-packages/gradio/blocks.py', inplace=True):
     47     if line.strip().startswith('self.server_name ='):
     48         line = '            self.server_name = server_name\n'

1 frames
[/usr/lib/python3.8/fileinput.py](https://localhost:8080/#) in _readline(self)
    340                     pass
    341                 # The next few lines may raise OSError
--> 342                 os.rename(self._filename, self._backupfilename)
    343                 self._file = open(self._backupfilename, self._mode)
    344                 try:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py' -> '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py.bak'

Happens every single time now. Was working an hour ago...

TheLastBen commented 1 year ago

colab switched to python 3.8, I'm waiting for a confirmation from multiple users to adjust the colabs

dillfrescott commented 1 year ago

Ah, okay

Jboby1 commented 1 year ago

colab switched to python 3.8, I'm waiting for a confirmation from multiple users to adjust the colabs

Are you saying that you need a certain threshold of people reporting the same error? I was experiencing the same error myself, but after a few times restarting all the cells it switched to a different error (ModuleNotFoundError: No module named 'git')

Of course, that could be a different issue entirely, but I felt it'd be better if I mention it.

plambe commented 1 year ago

My colab is at python3.8 too. Changing the paths for the patches works for me, but there are multiple other dependencies missing.

Balerion300 commented 1 year ago

Can also confirm that I'm getting the same error on my colab.

lgbpaiva commented 1 year ago
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-12-55b102f3c5f0>](https://localhost:8080/#) in <module>
     44 if Use_Gradio_Server:
     45   share='--share'
---> 46   for line in fileinput.input('/usr/local/lib/python3.7/dist-packages/gradio/blocks.py', inplace=True):
     47     if line.strip().startswith('self.server_name ='):
     48         line = '            self.server_name = server_name\n'

1 frames
[/usr/lib/python3.8/fileinput.py](https://localhost:8080/#) in _readline(self)
    340                     pass
    341                 # The next few lines may raise OSError
--> 342                 os.rename(self._filename, self._backupfilename)
    343                 self._file = open(self._backupfilename, self._mode)
    344                 try:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py' -> '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py.bak'

Happens every single time now. Was working an hour ago...

Came here to say this, got the same problem just now.

roberto-donext commented 1 year ago

For me now appear this error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-6-3165d779d0bc>](https://localhost:8080/#) in <module>
     60   srv= getoutput('cat /content/srvr.txt')
     61 
---> 62   for line in fileinput.input('/usr/local/lib/python3.7/dist-packages/gradio/blocks.py', inplace=True):
     63     if line.strip().startswith('self.server_name ='):
     64         line = f'            self.server_name = "{srv[8:]}"\n'

1 frames
[/usr/lib/python3.8/fileinput.py](https://localhost:8080/#) in _readline(self)
    340                     pass
    341                 # The next few lines may raise OSError
--> 342                 os.rename(self._filename, self._backupfilename)
    343                 self._file = open(self._backupfilename, self._mode)
    344                 try:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py' -> '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py.bak'
herbertwestern commented 1 year ago

I can confirm as well

plambe commented 1 year ago

Here's a list of python modules that I had to install !pip install GitPython jsonmerge einops clean-fid clip resize_right torchdiffeq lark omegaconf lpips basicsr pytorch_lightning piexif fonts triton

but it now fails like that

WARNING:root:A matching Triton is not available, some optimizations will not be enabled.
Error caught was: module 'triton.language' has no attribute 'constexpr'
/usr/local/lib/python3.8/dist-packages/pytorch_lightning/utilities/distributed.py:258: LightningDeprecationWarning: `pytorch_lightning.utilities.distributed.rank_zero_only` has been deprecated in v1.8.1 and will be removed in v1.10.0. You can import it from `pytorch_lightning.utilities` instead.
  rank_zero_deprecation(
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/AI/thelastben_sd/stable-diffusion-webui/webui.py", line 14, in <module>
    from modules import shared, devices, sd_samplers, upscaler, extensions, localization, ui_tempdir
  File "/content/gdrive/MyDrive/AI/thelastben_sd/stable-diffusion-webui/modules/sd_samplers.py", line 11, in <module>
    from modules import prompt_parser, devices, processing, images
  File "/content/gdrive/MyDrive/AI/thelastben_sd/stable-diffusion-webui/modules/processing.py", line 15, in <module>
    import modules.sd_hijack
  File "/content/gdrive/MyDrive/AI/thelastben_sd/stable-diffusion-webui/modules/sd_hijack.py", line 10, in <module>
    import modules.textual_inversion.textual_inversion
  File "/content/gdrive/MyDrive/AI/thelastben_sd/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 13, in <module>
    from modules import shared, devices, sd_hijack, processing, sd_models, images, sd_samplers
  File "/content/gdrive/MyDrive/AI/thelastben_sd/stable-diffusion-webui/modules/images.py", line 16, in <module>
    from fonts.ttf import Roboto
ImportError: cannot import name 'Roboto' from 'fonts.ttf' (/usr/local/lib/python3.8/dist-packages/fonts/ttf/__init__.py)
MysticSpiderman commented 1 year ago

Also getting an error on xformers

"--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in 4 from IPython.display import HTML 5 from IPython.display import clear_output ----> 6 import wget 7 import time 8

ModuleNotFoundError: No module named 'wget'


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below."

plambe commented 1 year ago

So I think I got it running by

It needs a high system RAM runtime in colab but now it runs fine.

adellanuki commented 1 year ago

image

MysticSpiderman commented 1 year ago

Can you clarify what you mean by adding the code to the first block? Which block exactly>? The google drive one or the Setting up The Environment one? Just want to make sure I am doing it properly. Got collab pro, so ready to run at high ram. Hoping to get it resolved. Thanks in advance.

plambe commented 1 year ago

Here's where I've added the pip command that installs the dependencies:

image

MysticSpiderman commented 1 year ago

Here's where I've added the pip command that installs the dependencies:

image

Ah, so to confirm that is for running the Automatic1111 Collab. Do we have a solution for the fast-dreambooth collab yet so I can train a model to THEN use in the Automatic? Going to try running automatic now anyways.

MysticSpiderman commented 1 year ago
Screen Shot 2022-11-30 at 5 19 27 PM

I know this may seem obvious - but how do I expand my the cell to view the whole code like in the image above in order to add in the additional code? Right now mine just looks like this. Cant figure out how to expand it like the image above.

plambe commented 1 year ago

I know this may seem obvious - but how do I expand my the cell to view the whole code

It's already expanded, click after the closing brace and press enter on your keyboard for a new line

MysticSpiderman commented 1 year ago

Thanks so much. I got automatic1111 up and running. Now - does the above technique also work for the fast-dreambooth collab? Have you tried it on that aswell yet?

Thanks again. Excited to continue working on things tonight.

plambe commented 1 year ago

IDK if it will work on dreambooth, but the same approach is most likely to work. In your place I'd do the same (https://github.com/TheLastBen/fast-stable-diffusion/issues/768#issuecomment-1332761995) and then if some python module is missing, I'd add it to the list of modules installed via !pip install <blabla>

MysticSpiderman commented 1 year ago

I know Ben is working on things in the meantime. So hopefully it will be resolved soon enough regardless. I am curious to try it - but I am not familiar enough with knowing how to fix it if it doesnt work. I'll give it a shot now. (Edit - I cant run two high ram sessions at once. And I dont want to close my automatic at the moment. So going to have to wait to try it, or Ill wait till someone else reports if they do.)

siraxe commented 1 year ago

IDK if it will work on dreambooth, but the same approach is most likely to work. In your place I'd do the same (#768 (comment)) and then if some python module is missing, I'd add it to the list of modules installed via !pip install <blabla> image

It's still broken even after this , doesn't do Save_Checkpoint_Every_n_Steps skips it all together in collab

MysticSpiderman commented 1 year ago

IDK if it will work on dreambooth, but the same approach is most likely to work. In your place I'd do the same (#768 (comment)) and then if some python module is missing, I'd add it to the list of modules installed via !pip install <blabla> image

It's still broken even after this , doesn't do Save_Checkpoint_Every_n_Steps skips it all together in collab

Are there any other ways for us to train models and then at least upload them from our drive into automatic1111? I tired one other collab for training by Shivam but that didnt work right now either.

MysticSpiderman commented 1 year ago

At this point my strategy for getting fast-dreambooth working is just being patient while Ben works on it.

To confirm - has anyone been able to get fast-dreambooth working yet since the errors?

TheLastBen commented 1 year ago

update the colab it should work now

MysticSpiderman commented 1 year ago

update the colab it should work now

Trying it out now. When you say Update the Colab - does that just mean reload the page? Want to make sure I am not missing anything. Thanks Ben.

Tried running - get the error under "Setting Up the Environment" "UsageError: Line magic function %%capture not found."

TheLastBen commented 1 year ago

the dreambooth colab isn't ready yet, the A1111 is

dillfrescott commented 1 year ago

update the colab it should work now

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-5-e692ee13db33>](https://localhost:8080/#) in <module>
     35 if Use_Gradio_Server:
     36   share='--share'
---> 37   for line in fileinput.input('/usr/local/lib/python3.8/dist-packages/gradio/blocks.py', inplace=True):
     38     if line.strip().startswith('self.server_name ='):
     39         line = '            self.server_name = server_name\n'

1 frames
[/usr/lib/python3.8/fileinput.py](https://localhost:8080/#) in _readline(self)
    340                     pass
    341                 # The next few lines may raise OSError
--> 342                 os.rename(self._filename, self._backupfilename)
    343                 self._file = open(self._backupfilename, self._mode)
    344                 try:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/gradio/blocks.py' -> '/usr/local/lib/python3.8/dist-packages/gradio/blocks.py.bak'
lhucklen commented 1 year ago

Is this fixed?

C3BCBC31-7E9C-4DA2-83CC-8B27B0531A97

lhucklen commented 1 year ago

8846EFD2-8EB2-4844-B61D-06F2765D0869

I can confirm there is no directory when searching for it in the path noted in the stack trace.

Any ideas on how to get this directory back in order?

dillfrescott commented 1 year ago

Guys, in the meanwhile I recommend using this colab: https://github.com/ddPn08/automatic1111-colab

It works fine and has been working as a good replacement till Ben fixes this one! :)

lhucklen commented 1 year ago

Was able to get the directory set up for python3.8 with gradio.

used pip install gradio

Pretty basic and it gave me the blocks.py file

Now I have this error

A52B01BB-7212-4646-A905-9048E2D03DE1

MysticSpiderman commented 1 year ago

While Ben is busy working on this - do we currently have any other way to train a model right now?

Is it possible to do it properly within automatic1111 once it is launched?

ShayanGsh commented 1 year ago

In the last cell, add the following right below import fileinput:

!pip install -q gradio GitPython jsonmerge einops clean-fid resize-right torchdiffeq gfpgan !pip install -q git+https://github.com/openai/CLIP.git !pip install -q torchsde transformers facexlib realesrgan lark safetensors omegaconf lpips basicsr pytorch-lightning piexif fonts font-roboto open-clip-torch

That fixed it for me

crapthings commented 1 year ago

this is the error output

Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 14, in <module>
    from modules import shared, devices, sd_samplers, upscaler, extensions, localization, ui_tempdir
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers.py", line 12, in <module>
    from modules import prompt_parser, devices, processing, images
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 15, in <module>
    import modules.sd_hijack
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack.py", line 4, in <module>
    import modules.textual_inversion.textual_inversion
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 13, in <module>
    from modules import shared, devices, sd_hijack, processing, sd_models, images, sd_samplers
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 18, in <module>
    from modules.sd_hijack_inpainting import do_inpainting_hijack, should_hijack_inpainting
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_inpainting.py", line 6, in <module>
    import ldm.models.diffusion.ddpm
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/ldm/models/diffusion/ddpm.py", line 24, in <module>
    from ldm.models.autoencoder import VQModelInterface, IdentityFirstStage, AutoencoderKL
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/ldm/models/autoencoder.py", line 8, in <module>
    from ldm.modules.diffusionmodules.model import Encoder, Decoder
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/ldm/modules/diffusionmodules/model.py", line 9, in <module>
    from ldm.modules.attention import LinearAttention
ImportError: cannot import name 'LinearAttention' from 'ldm.modules.attention' (/content/gdrive/MyDrive/sd/stable-diffusion-webui/ldm/modules/attention.py)
TheLastBen commented 1 year ago

remove the folder sd and use the latest colab

webyroki commented 1 year ago

NameError Traceback (most recent call last) in 76 get_ipython().system("grep -o 'https[^ ]*' /content/srv.txt >srvr.txt") 77 time.sleep(2) ---> 78 srv= getoutput('cat /content/srvr.txt') 79 80 for line in fileinput.input('/usr/local/lib/python3.8/dist-packages/gradio/blocks.py', inplace=True):

NameError: name 'getoutput' is not defined

TheLastBen commented 1 year ago

rerun the requirements cell

webyroki commented 1 year ago

rerun the requirements cell

Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 23, in import modules.extras File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/extras.py", line 20, in from modules.ui import plaintext_to_html File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/ui.py", line 23, in from modules.ui_components import FormRow, FormGroup, ToolButton, FormHTML ImportError: cannot import name 'FormHTML' from 'modules.ui_components' (/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/ui_components.py)

ShayanGsh commented 1 year ago

@webyroki I believe you need to delete the sd folder from your google drive and reinstall everything

steelerocky commented 1 year ago

@webyroki I believe you need to delete the sd folder from your google drive and reinstall everything

yesterday, it worked fine for me after I deleted sd folder from my google drive and reinstalled everything. But today I tried to connect it again, it is giving me error again

Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 13, in <module> from modules.call_queue import wrap_queued_call, queue_lock, wrap_gradio_gpu_call File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 7, in <module> from modules import shared, progress File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/shared.py", line 9, in <module> import gradio as gr File "/usr/local/lib/python3.8/dist-packages/gradio/__init__.py", line 3, in <module> import gradio.components as components File "/usr/local/lib/python3.8/dist-packages/gradio/components.py", line 32, in <module> from gradio.blocks import Block File "/usr/local/lib/python3.8/dist-packages/gradio/blocks.py", line 23, in <module> from gradio import ( ImportError: cannot import name 'queueing' from partially initialized module 'gradio' (most likely due to a circular import) (/usr/local/lib/python3.8/dist-packages/gradio/__init__.py)

TheLastBen commented 1 year ago

You don't need to delete the SD folder anymore just use the latest colab

steelerocky commented 1 year ago

Facing the error again

Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 16, in <module> from modules import extra_networks_hypernet, ui_extra_networks_hypernets, ui_extra_networks_textual_inversion File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/extra_networks_hypernet.py", line 2, in <module> from modules.hypernetworks import hypernetwork File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/hypernetworks/hypernetwork.py", line 10, in <module> import modules.textual_inversion.dataset File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/dataset.py", line 13, in <module> from modules import devices, shared File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/shared.py", line 16, in <module> from modules import localization, extensions, script_loading, errors, ui_components, shared_items File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/extensions.py", line 10, in <module> extensions_dir = os.path.join(paths.data_path, "extensions") AttributeError: module 'modules.paths' has no attribute 'data_path'

Sakib2263 commented 1 year ago

Facing similar error: Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 22, in import gradio File "/usr/local/lib/python3.9/dist-packages/gradio/init.py", line 3, in import gradio.components as components File "/usr/local/lib/python3.9/dist-packages/gradio/components.py", line 33, in from gradio.blocks import Block, BlockContext File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 23, in from gradio import ( ImportError: cannot import name 'encryptor' from partially initialized module 'gradio' (most likely due to a circular import) (/usr/local/lib/python3.9/dist-packages/gradio/init.py)

TheLastBen commented 1 year ago

does the issue still persist ?

AnGoga commented 1 year ago

2-3 days ago I had the same problem. I didn't do anything myself, just did "Install/Update AUTOMATIC1111 repo" and "Requirements" as usual before running. image FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.9/dist-packages/gradio/blocks.py' -> '/usr/local/lib/python3.9/dist-packages/gradio/blocks.py.bak'

If you install this, then an error occurs

!pip install -q gradio GitPython jsonmerge einops clean-fid resize-right torchdiffeq gfpgan !pip install -q git+https://github.com/openai/CLIP.git !pip install -q torchsde transformers facexlib realesrgan lark safetensors omegaconf lpips basicsr pytorch-lightning piexif fonts font-roboto open-clip-torch

image Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 22, in import gradio File "/usr/local/lib/python3.9/dist-packages/gradio/init.py", line 3, in import gradio.components as components File "/usr/local/lib/python3.9/dist-packages/gradio/components.py", line 33, in from gradio.blocks import Block, BlockContext File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 23, in from gradio import ( ImportError: cannot import name 'encryptor' from partially initialized module 'gradio' (most likely due to a circular import) (/usr/local/lib/python3.9/dist-packages/gradio/init.py)

Any ideas how to solve this problem?

TheLastBen commented 1 year ago

Simply use the latest notebook from the official link

ansel44 commented 1 year ago

colab switched to python 3.8, I'm waiting for a confirmation from multiple users to adjust the colabs

hello my friend ,how can we use localtunnel again,? we need it