danielroich / PTI

Official Implementation for "Pivotal Tuning for Latent-based editing of Real Images" (ACM TOG 2022) https://arxiv.org/abs/2106.05744
MIT License
905 stars 114 forks source link

Colab Unpickling Error #11

Closed eridgd closed 3 years ago

eridgd commented 3 years ago

Running the colab notebook throws an unpickling error at "Use PTI with e4e backbone for StyleCLIP"

---------------------------------------------------------------------------
UnpicklingError                           Traceback (most recent call last)
<ipython-input-38-29c3e7342ea3> in <module>()
      1 hyperparameters.first_inv_type = 'w+'
      2 os.chdir('/content/PTI')
----> 3 model_id = run_PTI(use_wandb=False, use_multi_id_training=False)

5 frames
/usr/local/lib/python3.7/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    775             "functionality.")
    776 
--> 777     magic_number = pickle_module.load(f, **pickle_load_args)
    778     if magic_number != MAGIC_NUMBER:
    779         raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, '<'.
danielroich commented 3 years ago

Hi @eridgd This problem occurs when one of the pre-trained models is missing. For example, the e4e encoder or one of the StyleCLIPs mappers.

This happened because too many people have downloaded the same file from Google Drive and it entered a protective mode which did not download the files when asked. This is why you got the error.

I have upgraded the notebook, it is now working with PyDrive making the download phase works all the time.

Please try again and let me know if it works now. Daniel

eridgd commented 3 years ago

It's working now, thank you!

Haadia-a commented 2 years ago

@eridgd I have a similar issue with colab unpickling. We cloned the repo on google colab. pkl.load() is giving an unpickling error. UnpicklingError: invalid load key, '\xef'. would you have any idea how to fix it?