(ldm) C:\WBC\latent-diffusion-main>python scripts/txt2img.py --prompt "a sunset behind a mountain range, vector image" --ddim_eta 1.0 --n_samples 1 --n_iter 1 --H 384 --W 1024 --scale 5.0
Loading model from models/ldm/text2img-large/model.ckpt
Traceback (most recent call last):
File "scripts/txt2img.py", line 108, in <module>
model = load_model_from_config(config, "models/ldm/text2img-large/model.ckpt") # TODO: check path
File "scripts/txt2img.py", line 19, in load_model_from_config
model = instantiate_from_config(config.model)
File "c:\wbc\latent-diffusion-main\ldm\util.py", line 78, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
File "c:\wbc\latent-diffusion-main\ldm\util.py", line 86, in get_obj_from_str
return getattr(importlib.import_module(module, package=None), cls)
File "C:\ProgramData\Anaconda3\envs\ldm\lib\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 "c:\wbc\latent-diffusion-main\ldm\models\diffusion\ddpm.py", line 12, in <module>
import pytorch_lightning as pl
File "C:\ProgramData\Anaconda3\envs\ldm\lib\site-packages\pytorch_lightning\__init__.py", line 20, in <module>
from pytorch_lightning import metrics # noqa: E402
File "C:\ProgramData\Anaconda3\envs\ldm\lib\site-packages\pytorch_lightning\metrics\__init__.py", line 15, in <module>
from pytorch_lightning.metrics.classification import ( # noqa: F401
File "C:\ProgramData\Anaconda3\envs\ldm\lib\site-packages\pytorch_lightning\metrics\classification\__init__.py", line 14, in <module>
from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401
File "C:\ProgramData\Anaconda3\envs\ldm\lib\site-packages\pytorch_lightning\metrics\classification\accuracy.py", line 18, in <module>
from pytorch_lightning.metrics.utils import deprecated_metrics, void
File "C:\ProgramData\Anaconda3\envs\ldm\lib\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' (C:\ProgramData\Anaconda3\envs\ldm\lib\site-packages\torchmetrics\utilities\data.py)
I can't run a latent diffusion neural network. I'm using anaconda and the environment that comes with the neural network. I think I'm doing everything right, but something goes wrong. If you know how to solve this problem, I would be extremely grateful.
CodePudding user response:
Looking at your error, it appears get_num_classes doesn't exist anymore. I verified this by looking that their github and docs.
It was removed after this commit.