CompVis / stable-diffusion

A latent text-to-image diffusion model
https://ommer-lab.com/research/latent-diffusion-models/
Other
66.51k stars 9.97k forks source link

ModuleNotFoundError: No module named 'ldm.util'; 'ldm' is not a package #818

Open zxk72 opened 6 months ago

zxk72 commented 6 months ago

When I run the command python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms, it returns an error: Traceback (most recent call last): File "scripts/txt2img.py", line 17, in from ldm.util import instantiate_from_config ModuleNotFoundError: No module named 'ldm.util'; 'ldm' is not a package

CreamyLong commented 6 months ago

Did you “pip install -e .” ?

Ontheroad123 commented 6 months ago

When I run the command python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms, it returns an error: Traceback (most recent call last): File "scripts/txt2img.py", line 17, in from ldm.util import instantiate_from_config ModuleNotFoundError: No module named 'ldm.util'; 'ldm' is not a package

Add code in txt2img.py : import sys sys.path.append('/***/stable-diffusion-master')