huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
26.22k stars 5.4k forks source link

Error running stable diffusion in colab. #9941

Open Mikeskates opened 5 hours ago

Mikeskates commented 5 hours ago

Describe the bug

I have been using a notebook that I found on a youtube video, so that I could use Stable Diffusion to generate images in colab. and it was working for months. but 5 days ago the same code started generating errors and I can no longer use it. Can someone help me?

This is the error I get...

AttributeError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name) 1777 try: -> 1778 return importlib.import_module("." + module_name, self.name) 1779 except Exception as e:

32 frames AttributeError: partially initialized module 'torchvision' has no attribute 'extension' (most likely due to a circular import)

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last) RuntimeError: Failed to import transformers.models.clip.image_processing_clip because of the following error (look up to see its traceback): partially initialized module 'torchvision' has no attribute 'extension' (most likely due to a circular import)

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/diffusers/utils/import_utils.py in _get_module(self, module_name) 853 return importlib.import_module("." + module_name, self.name) 854 except Exception as e: --> 855 raise RuntimeError( 856 f"Failed to import {self.name}.{module_name} because of the following error (look up to see its" 857 f" traceback):\n{e}"

RuntimeError: Failed to import diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion because of the following error (look up to see its traceback): Failed to import transformers.models.clip.image_processing_clip because of the following error (look up to see its traceback): partially initialized module 'torchvision' has no attribute 'extension' (most likely due to a circular import)

Reproduction

this is the code I used

!pip install diffusers["torch"] transformers !pip install accelerate !pip install git+https://github.com/huggingface/diffusers

import torch from diffusers import StableDiffusionPipeline from diffusers import DPMSolverMultistepScheduler

pipe = StableDiffusionPipeline.from_pretrained("IDK-ab0ut/Yiffymix_v43",torch_dtype=torch.float16) pipe = pipe.to("cuda") pipe.safety_checker = None pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)

it also doesn't work if I change the checkpoint to a different model. Please help! (I don't know anything about coding)

Logs

No response

System Info

I'm using colab so I don't know if you want their system info or the shitty laptop that I am on. on colab I am using a T4GPU. My laptop is garbage. don't really know it's stats, only that this worked for months and now doesn't.

Who can help?

No response

a-r-r-o-w commented 5 hours ago

Hi. As the error states, this does not seem related to Diffusers. Could you try and make sure that torchvision is correctly installed in Colab?

If you see that it is being installed/upgraded/downgraded when you do pip install diffusers in Colab, please make sure to restart the notebook.

If the torchvision version you are using does not match the one required by Diffusers, or is the latest release (which might be untested to work by us), you could be facing these errors.