stable-diffusion
stable-diffusion copied to clipboard
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data'
Getting the following error following the instructions
python scripts/txt2img.py --prompt "a virus monster is playing guitar, oil on canvas" --ddim_eta 0.0 --n_samples 4 --n_iter 4 --scale 5.0 --ddim_steps 50
Traceback (most recent call last):
File "scripts/txt2img.py", line 11, in
conda uninstall torchmetrics conda install torchmetrics=0.5
Got an error doing just conda install torchmetrics=0.5
.
According to https://anaconda.org/conda-forge/torchmetrics the correct command is:
conda install -c conda-forge torchmetrics=0.5
torchmetrics 0.7 worked for me, had same problem
pip uninstall torchmetrics pip install torchmetrics==0.7
Don't forget to activate conda environment in case you're using conda