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

Error when trying to run notebook all of a sudden

Open dillfrescott opened this issue 2 years ago • 35 comments

---------------------------------------------------------------------------
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...

dillfrescott avatar Nov 30 '22 20:11 dillfrescott

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

TheLastBen avatar Nov 30 '22 20:11 TheLastBen

Ah, okay

dillfrescott avatar Nov 30 '22 20:11 dillfrescott

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.

Jboby1 avatar Nov 30 '22 20:11 Jboby1

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

plambe avatar Nov 30 '22 21:11 plambe

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

Balerion300 avatar Nov 30 '22 21:11 Balerion300

---------------------------------------------------------------------------
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.

lgbpaiva avatar Nov 30 '22 21:11 lgbpaiva

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'

roberto-donext avatar Nov 30 '22 21:11 roberto-donext

I can confirm as well

herbertwestern avatar Nov 30 '22 21:11 herbertwestern

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)

plambe avatar Nov 30 '22 21:11 plambe

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."

MysticSpiderman avatar Nov 30 '22 21:11 MysticSpiderman

So I think I got it running by

  • using colab's search and replace (menu edit), I replaced all occurrences of python3.7 with python3.8
  • then in the first code block I added the following to deal with the missing dependencies:
!pip install GitPython jsonmerge einops clean-fid clip resize_right torchdiffeq lark omegaconf lpips basicsr pytorch_lightning piexif fonts font-roboto triton==2.0.0.dev20221120 transformers facexlib gfpgan realesrgan

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

plambe avatar Nov 30 '22 21:11 plambe

image

adellanuki avatar Nov 30 '22 21:11 adellanuki

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.

MysticSpiderman avatar Nov 30 '22 21:11 MysticSpiderman

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

image

plambe avatar Nov 30 '22 22:11 plambe

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 avatar Nov 30 '22 22:11 MysticSpiderman

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.

MysticSpiderman avatar Nov 30 '22 22:11 MysticSpiderman

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

plambe avatar Nov 30 '22 22:11 plambe

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.

MysticSpiderman avatar Nov 30 '22 22:11 MysticSpiderman

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>

plambe avatar Nov 30 '22 22:11 plambe

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.)

MysticSpiderman avatar Nov 30 '22 22:11 MysticSpiderman

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

siraxe avatar Nov 30 '22 22:11 siraxe

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 avatar Nov 30 '22 23:11 MysticSpiderman

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?

MysticSpiderman avatar Dec 01 '22 00:12 MysticSpiderman

update the colab it should work now

TheLastBen avatar Dec 01 '22 02:12 TheLastBen

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."

MysticSpiderman avatar Dec 01 '22 02:12 MysticSpiderman

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

TheLastBen avatar Dec 01 '22 02:12 TheLastBen

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'

dillfrescott avatar Dec 01 '22 02:12 dillfrescott

Is this fixed?

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

lhucklen avatar Dec 01 '22 03:12 lhucklen

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?

lhucklen avatar Dec 01 '22 04:12 lhucklen

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! :)

dillfrescott avatar Dec 01 '22 04:12 dillfrescott