nerdyrodent / VQGAN-CLIP

Just playing with getting VQGAN+CLIP running locally, rather than having to use colab.
Other
2.59k stars 427 forks source link

Error when trying to generate image (noob) any help would be appreciated #71

Closed Jackiplier closed 2 years ago

Jackiplier commented 2 years ago

(vqgan) D:\art\VQGAN-CLIP>python generate.py -p "A painting of an apple in a fruit bowl" 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. Traceback (most recent call last): File "D:\art\VQGAN-CLIP\generate.py", line 546, in model = load_vqgan_model(args.vqgan_config, args.vqgan_checkpoint).to(device) File "D:\art\VQGAN-CLIP\generate.py", line 520, in load_vqgan_model model.init_from_ckpt(checkpoint_path) File "D:\art\VQGAN-CLIP\taming-transformers\taming\models\vqgan.py", line 52, in init_from_ckpt self.load_state_dict(sd, strict=False) File "D:\ana3\envs\vqgan\lib\site-packages\torch\nn\modules\module.py", line 1406, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for VQModel: size mismatch for loss.discriminator.main.8.weight: copying a param with shape torch.Size([1, 256, 4, 4]) from checkpoint, the shape in current model is torch.Size([512, 256, 4, 4]). size mismatch for quantize.embedding.weight: copying a param with shape torch.Size([16384, 256]) from checkpoint, the shape in current model is torch.Size([1024, 256]).

wasyleque commented 2 years ago

Same error on windows:

(vqgan) D:\VQGAN-CLIP>python generate.py -p "A painting of an apple in a fruit bowl"
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.
Traceback (most recent call last):
  File "D:\VQGAN-CLIP\generate.py", line 546, in <module>
    model = load_vqgan_model(args.vqgan_config, args.vqgan_checkpoint).to(device)
  File "D:\VQGAN-CLIP\generate.py", line 520, in load_vqgan_model
    model.init_from_ckpt(checkpoint_path)
  File "C:\Users\ja\MiniConda3\envs\vqgan\lib\site-packages\taming\models\vqgan.py", line 41, in init_from_ckpt
    sd = torch.load(path, map_location="cpu")["state_dict"]
  File "C:\Users\ja\MiniConda3\envs\vqgan\lib\site-packages\torch\serialization.py", line 608, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "C:\Users\ja\MiniConda3\envs\vqgan\lib\site-packages\torch\serialization.py", line 777, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'm'.
JasonHoku commented 2 years ago

@Jackiplier @wasyleque Can you include the OS Version and CPU Model of your system to improve this issue report?

That would be found in windows at the System Information app.

Some additional information such as Python version, pytorch version and steps to reproduce the issue may also come in handy here, thank you.