Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The problem with launching Stable Diffusion AUTOMATIC1111 in Google Colab #332

Open
SnezhovSD opened this issue Jul 27, 2024 · 1 comment

Comments

@SnezhovSD
Copy link

Problem: When running Stable Diffusion AUTOMATIC 1111 in the Google Collab environment, an import error occurs:

Downloading: "https://github.com/DagnyT/hardnet/raw/master/pretrained/train_liberty_with_aug/checkpoint_liberty_with_aug.pth" to /content/gdrive/MyDrive/sd/stable-diffusion-webui/cache/hub/checkpoints/checkpoint_liberty_with_aug.pth
100% 5.10M/5.10M [00:00<00:00, 190MB/s]
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 13, in
initialize.imports()
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/initialize.py", line 39, in imports
from modules import processing, gradio_extensons, ui # noqa: F401
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 18, in
import modules.sd_hijack
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack.py", line 5, in
from modules import devices, sd_hijack_optimizations, shared, script_callbacks, errors, sd_unet, patches
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_optimizations.py", line 13, in
from modules.hypernetworks import hypernetwork
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/hypernetworks/hypernetwork.py", line 8, in
import modules.textual_inversion.dataset
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/dataset.py", line 12, in
from modules import devices, shared, images
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/images.py", line 22, in
from modules import sd_samplers, shared, script_callbacks, errors
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers.py", line 5, in
from modules import sd_samplers_kdiffusion, sd_samplers_timesteps, sd_samplers_lcm, shared, sd_samplers_common, sd_schedulers
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 3, in
import k_diffusion.sampling
File "/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/init.py", line 1, in
from . import augmentation, config, evaluation, external, gns, layers, models, sampling, utils
File "/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/augmentation.py", line 6, in
from skimage import transform
File "/usr/local/lib/python3.10/dist-packages/skimage/_shared/lazy.py", line 62, in getattr
return importlib.import_module(f'{package_name}.{name}')
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.10/dist-packages/skimage/transform/init.py", line 4, in
from .radon_transform import (radon, iradon, iradon_sart,
File "/usr/local/lib/python3.10/dist-packages/skimage/transform/radon_transform.py", line 6, in
from ._warps import warp
File "/usr/local/lib/python3.10/dist-packages/skimage/transform/_warps.py", line 9, in
from ..measure import block_reduce
File "/usr/local/lib/python3.10/dist-packages/skimage/measure/init.py", line 2, in
from ._marching_cubes_lewiner import marching_cubes
File "/usr/local/lib/python3.10/dist-packages/skimage/measure/_marching_cubes_lewiner.py", line 7, in
from ._marching_cubes_classic import _marching_cubes_classic
File "/usr/local/lib/python3.10/dist-packages/skimage/measure/_marching_cubes_classic.py", line 3, in
from . import _marching_cubes_classic_cy
ImportError: cannot import name '_marching_cubes_classic_cy' from partially initialized module 'skimage.measure' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/skimage/measure/init.py)

I believe that the error indicates that it is not possible to import the function _marching_cubes_classic_cy from the module sk image.measure'. Most likely, this is caused by cyclic import inside the sk image.measure` module.

The Python version in Google Colab: 3.10.12
Version scikit-image: 0.23.2

Need help solving this error, thanks in advance

@SnezhovSD
Copy link
Author

This error may occur due to incompatible library versions or incorrect import order. Here are a few steps you can try to solve the problem:

  1. Update the scikit-image to the latest version: Perhaps your version of scikit-image is outdated or has bugs. Try to update it:

!pip install --upgrade scikit-image

  1. Restart the runtime: After updating the library, restart the runtime for the changes to take effect.

  2. Check that the import is correct: Make sure that you are importing modules correctly and that there are no cyclic dependencies in your code.

  3. Use an alternative solution: If the problem persists, try using another method from sk image.measure that performs similar tasks without calling _marching_cubes_classic_cycle.

If these steps don't help, try installing a specific version of scikit-image that definitely worked before.:

!pip install scikit-image==0.18.3

After completing these steps, restart the runtime and check if the error has been resolved.

An error may also come out:

Stable diffusion model failed to load ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/websockets/websockets_impl.py", line 225, in run_asgi

An error loading the Stable Diffusion model can be caused by a number of reasons, including incompatibility of library versions or dependency problems. You need to make sure that all the necessary dependencies are installed correctly and compatible with each other.

Here are the steps you can try to fix this error:

  1. Make sure that all major libraries are installed:

!pip install torch torchvision torchaudio fastapi uvicorn gradio

  1. Download the Stable Diffusion model:
    Make sure that you have access to the model and it loads correctly. If you are using a specific repository or script, follow its instructions for installing dependencies.

  2. Check the configuration of your application:
    Make sure that your Fast AVI or Radio application is configured correctly and does not contain errors.

  3. Restart the runtime environment:
    Restarting the runtime can help clear up any temporary conflicts or errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant