tnwei/vqgan-clip-app

Newbie question: AttributeError: module 'clip' has no attribute 'load'

Berkgasm opened this issue · 4 comments

Hello, I did the setup but when I try to use it I am getting an error. I think I messed up the setup at some point.

Local URL: http://localhost:8501
Network URL: http://192.168.1.146:8501

Using device: cuda:0
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
loaded pretrained LPIPS loss from taming/modules/autoencoder/lpips\vgg.pth
VQLPIPSWithDiscriminator running with hinge loss.
Restored from assets/vqgan_imagenet_f16_16384.ckpt
2021-09-27 10:06:08.915 Traceback (most recent call last):
File "c:\users-\anaconda3\lib\site-packages\streamlit\script_runner.py", line 354, in _run_script
exec(code, module.dict)
File "C:\Users-\CLIP-Guided-Diffusion\app.py", line 358, in
generate_image(
File "C:\Users-\CLIP-Guided-Diffusion\app.py", line 69, in generate_image
st.session_state["model"], st.session_state["perceptor"] = run.load_model()
File "C:\Users-\CLIP-Guided-Diffusion\logic.py", line 128, in load_model
clip.load(self.args.clip_model, jit=False)[0]
AttributeError: module 'clip' has no attribute 'load'

tnwei commented

Hi! Well that's an interesting error, as Python could import clip, but the load function can't be found.

Can you trying uninstalling and re-installing clip with pip uninstall clip, then pip install git+https://github.com/openai/CLIP? Also please run git pull while you're at it, as I've pushed quite a number of edits recently

Thank you!, it's working now.

tnwei commented

Great to hear! 👍

I ran into this same problem, and the fix you mentioned works. Thanks!