CompVis / latent-diffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
11.85k stars 1.53k forks source link

Error, no parenthesis on print #71

Open MyUsernamee opened 2 years ago

MyUsernamee commented 2 years ago

After creating a conda env like specified in the readme and downloading the models, I can't run the text2im script, I get this error:

  File "scripts/txt2img.py", line 10, in <module>
    from ldm.util import instantiate_from_config
  File "/home/dihydromonoxide/.local/lib/python3.8/site-packages/ldm.py", line 77
    print os.path.exists("%s.bz2"%(predictor_path))

To do this I ran:

$ conda activate ldm # To activate it
$ mkdir -p models/ldm/text2img-large/ # To download the model
$ wget -O models/ldm/text2img-large/model.ckpt https://ommer-lab.com/files/latent-diffusion/nitro/txt2img-f8-large/model.ckpt
$ python3 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 # To run it

I am running the latest version of conda 4.12.0 and python 3.8.5.

Thank you for any help in advance! It is probably something simple. :(

trufty commented 2 years ago

I assumed I was missing a python package named ldm, which was incorrect. I just needed to append a system path sys.path.append('.') so it includes the ./ldm folder scripts.

MyUsernamee commented 2 years ago

Where did you add that?

trufty commented 2 years ago

below import sys in the pipeline

eformx commented 2 years ago

place it in txt2Img.py and then fix other issues like these:

in autoencoder.py by you need taming module which requires pip install taming-transformers and then change this: from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer to this: from taming.modules.vqvae.quantize import VectorQuantizer as VectorQuantizer as VectorQuanitizer2 does not exist in quantize.py

and then it all runs.