tnwei/vqgan-clip-app

Requirements

hekodemus opened this issue · 6 comments

Hello,

I installed all and took requirement libs from EleutherAI/vqgan-clip repo. I can get imagenet, wiki and coco dataset working but others will not work. Are those libs up to date? Thus having error

ModuleNotFoundError: No module named 'taming.modules.misc'

tnwei commented

Hi! If I understand you correctly, you were using the same Python environment from installing EleutherAI/vqgan-clip? I would suggest recreating the Python environment using the instructions in this repo.

Also, can you paste here the full error message from the console? When the error shows up in the app, a much more detailed printout will be shown in the console which will help greatly with debugging.

I had the same problem, and I didn't get any errors when installing the environment. I tried to run the requirements.txt file from the source repo and got an error when I got to torch.

ERROR: Could not find a version that satisfies the requirement torch==1.9.1 matching distribution found for torch==1.9.1

tnwei commented

Hi @dustovshio! I would advise the same, which is to recreate the Python environment using the instructions in this repo, instead of reusing the one from EleutherAI/vqgan-clip. The EleutherAI repo uses Pytorch 1.9 while this uses Pytorch 1.10, which is needed to allow conda to find a compatible version of opencv for generating scrolling/zooming images.

how do you "recreate the environment" I already stated I tried the method to create the environment and when got the same pytorch error which is why I went to the original source in the first place.
when I type the command conda env create -f environment.yml I get the following message

CondaValueError: prefix already exists: C:\Users\d\anaconda3\envs\vqgan-clip-app

ModuleNotFoundError: No module named 'torch'
Traceback:
File "C:\Users\d\AppData\Local\Programs\Python\Python310\lib\site-packages\streamlit\script_runner.py", line 379, in _run_script
exec(code, module.dict)
File "C:\Users\d\vqgan-clip-app\app.py", line 34, in
from logic import VQGANCLIPRun
File "C:\Users\d\vqgan-clip-app\logic.py", line 5, in
from vqgan_utils import (
File "C:\Users\d\vqgan-clip-app\vqgan_utils.py", line 2, in
import torch

I was getting errors for several of the other libraries and modules but I manually installed them and they went away. But for some reason I can't seem to install torch.

It looks like torch may not be compatible with python 3.9+ so I uninstalled and will try again with 3.8.10

RuntimeError: unexpected EOF, expected 13177868 more bytes. The file might be corrupted.
Traceback:
File "C:\Users\d\AppData\Roaming\Python\Python38\site-packages\streamlit\script_runner.py", line 379, in _run_script
exec(code, module.dict)
File "C:\Users\d\vqgan-clip-app\app.py", line 611, in
generate_image(
File "C:\Users\d\vqgan-clip-app\app.py", line 107, in generate_image
st.session_state["model"], st.session_state["perceptor"] = run.load_model()
File "C:\Users\d\vqgan-clip-app\logic.py", line 164, in load_model
self.model = load_vqgan_model(
File "C:\Users\d\vqgan-clip-app\vqgan_utils.py", line 189, in load_vqgan_model
parent_model.init_from_ckpt(checkpoint_path)
File "C:\Users\d\AppData\Roaming\Python\Python38\site-packages\taming\models\cond_transformer.py", line 40, in init_from_ckpt
sd = torch.load(path, map_location="cpu")["state_dict"]
File "C:\Users\d\AppData\Roaming\Python\Python38\site-packages\torch\serialization.py", line 608, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "C:\Users\d\AppData\Roaming\Python\Python38\site-packages\torch\serialization.py", line 794, in _legacy_load
deserialized_objects[key].set_from_file(f, offset, f_should_read

tnwei commented

Hi dustovshio, the latest error message posted throws an error when loading the models, so it is possible that the model you were trying to load is corrupted and needs to be re-downloaded. The default model is vqgan_imagenet_f16_1024.

If you had issues with specific libraries before, chances are manually installing packages to resolve their respective errors broke your Pytorch installation, especially if you used pip to install packages. The requirements in the EleutherAI/vqgan-clip repo pins the exact specifications of all packages used, which works very well if you just want to run their code only, but not so much for compatibility with other use cases. I would be surprised if this app can still run after doing pip install using their requirements.

To resolve the CondaValueError: prefix already exists error message, first run conda env remove -n vqgan-clip-app before running conda env create -f environment.yml. This will allow you to recreate the Python env. Hope this helps!