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

_pickle.UnpicklingError: invalid load key, 'm'. #69

Closed Fusseldieb closed 2 years ago

Fusseldieb commented 2 years ago

I installed it yesterday on my work machine and it worked just as it should

Today I tried to install it on my home machine, but I get following error:

vstil@DESKTOP-R251CM7 MINGW64 ~/VQGAN-CLIP (main)
$ python generate.py -se 1 -p "a cat"
C:\Users\vstil\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
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 "C:\Users\vstil\VQGAN-CLIP\generate.py", line 546, in <module>
    model = load_vqgan_model(args.vqgan_config, args.vqgan_checkpoint).to(device)
  File "C:\Users\vstil\VQGAN-CLIP\generate.py", line 520, in load_vqgan_model
    model.init_from_ckpt(checkpoint_path)
  File "taming-transformers\taming\models\vqgan.py", line 45, in init_from_ckpt
    sd = torch.load(path, map_location="cpu")["state_dict"]
  File "C:\Users\vstil\AppData\Local\Programs\Python\Python39\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\vstil\AppData\Local\Programs\Python\Python39\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'.

I already tried to redownload the VQGAN-CLIP repo to no avail...

Any help would be greatly appreciated!

Fusseldieb commented 2 years ago

Yea, somehow the vqgan checkpoints file was corrupted... That was the only thing that I have just moved out of the VQGAN repo folder and later back inside.

Did an

$ rm checkpoints/*
$ bash download_models.sh

and now it works :D