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

Install missing and downgrade certain python packages #4

Open
basujindal opened this issue Aug 12, 2022 · 1 comment
Open

Install missing and downgrade certain python packages #4

basujindal opened this issue Aug 12, 2022 · 1 comment

Comments

@basujindal
Copy link

basujindal commented Aug 12, 2022

  • Running the following command python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms gives the following error on Ubuntu 20.04:
  File "scripts/txt2img.py", line 11, in <module>
    from pytorch_lightning import seed_everything
  File "/home/thunder/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/__init__.py", line 20, in <module>
    from pytorch_lightning import metrics  # noqa: E402
  File "/home/thunder/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/metrics/__init__.py", line 15, in <module>
    from pytorch_lightning.metrics.classification import (  # noqa: F401
  File "/home/thunder/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/__init__.py", line 14, in <module>
    from pytorch_lightning.metrics.classification.accuracy import Accuracy  # noqa: F401
  File "/home/thunder/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/accuracy.py", line 18, in <module>
    from pytorch_lightning.metrics.utils import deprecated_metrics, void
  File "/home/thunder/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/metrics/utils.py", line 22, in <module>
    from torchmetrics.utilities.data import get_num_classes as _get_num_classes
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/home/thunder/anaconda3/envs/ldm/lib/python3.8/site-packages/torchmetrics/utilities/data.py)

I could solve it by downgrading torchmetrics to version 0.6.0 by running pip install torchmetrics==0.6.0

  • Running the command again I got the error,
Loading model from models/ldm/stable-diffusion-v1/model.ckpt
Global Step: 440000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
  File "scripts/txt2img.py", line 279, in <module>
    main()
  File "scripts/txt2img.py", line 188, in main
    model = load_model_from_config(config, f"{opt.ckpt}")
  File "scripts/txt2img.py", line 31, in load_model_from_config
    model = instantiate_from_config(config.model)
  File "/home/thunder/stable-diffusion/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/home/thunder/stable-diffusion/ldm/models/diffusion/ddpm.py", line 461, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "/home/thunder/stable-diffusion/ldm/models/diffusion/ddpm.py", line 519, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "/home/thunder/stable-diffusion/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/home/thunder/stable-diffusion/ldm/util.py", line 93, in get_obj_from_str
    return getattr(importlib.import_module(module, package=None), cls)
  File "/home/thunder/anaconda3/envs/ldm/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/thunder/stable-diffusion/ldm/modules/encoders/modules.py", line 7, in <module>
    import kornia
ModuleNotFoundError: No module named 'kornia'

This can be solved by simply installing kornia pip install kornia

@Slacksarenice
Copy link

Slacksarenice commented Aug 12, 2022

If I'm not mistaken I'm pretty sure upgrading pytorch to the latest version will also resolve this issue.

enzymezoo-code pushed a commit to enzymezoo-code/stable-diffusion that referenced this issue Aug 23, 2022
Change shell commands to python api calls
fragmede pushed a commit to fragmede/stable-diffusion that referenced this issue Sep 9, 2022
realESRGAN upscaling for gobig
colemickens pushed a commit to colemickens/stable-diffusion that referenced this issue Sep 15, 2022
weighted prompts similar to Midjourney
colemickens pushed a commit to colemickens/stable-diffusion that referenced this issue Sep 15, 2022
This reverts commit eae4ec8, reversing
changes made to 5ae104b.
rohitgr7 added a commit to Lightning-AI/stable-diffusion that referenced this issue Oct 21, 2022
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants