Giter Club home page Giter Club logo

Comments (23)

HenrySaba avatar HenrySaba commented on July 21, 2024 4

Fixed it! Instead of using the link as such:

https://drive.google.com/file/d/{file_id}

You should use the link in the following format:

https://drive.google.com/uc?id={file_id}

from stylegan-encoder.

pbaylies avatar pbaylies commented on July 21, 2024 3

This is a known issue with Google Drive quotas; as a workaround, you can try to go into that Google Drive, share the file to your own account, and then make a copy there and download that URL. Also note that when you do download it, you'll have it stored locally in a cache directory if you need it later.

from stylegan-encoder.

B-Yassine avatar B-Yassine commented on July 21, 2024 3

Thank you so much i resolved it. The problem was in the tqdm version pre-installed in google colab.
I had to downgrade to tqdm==4.24.0

!pip install --force tqdm==4.24.0

from stylegan-encoder.

serarmani avatar serarmani commented on July 21, 2024 1

I have same issue but my laptop doesn't have GPU any way I can perform it on colab only.I am using only 3 images for my purpose.

here is what you need to do:
1- download the pickle file manually (from the link that the error already shows)
2- upload it to your google drive
3- change the sharing option from only you to anyone with the link.
4- generate and copy the sharing link from of uploaded file from your google drive
5- in the link change the file/d/ part to uc?id=
6- delete the ending part (/view?usp=sharing)
7- from file tab of your colab notebook, find and click on encode_images.py
8- on the right side of your browser the code will open. find the parsers sections
9- find the line which gives the default url to load the pickle file: parser.add_argument('--model_url', default=
10- change the url to what we created in the previous steps.
thats it.

from stylegan-encoder.

B-Yassine avatar B-Yassine commented on July 21, 2024

Thank you for your response. That's exactely what i did and it worked!. However, i am getting this error now:

File "encode_images.py", line 116, in main generator_network, discriminator_network, Gs_network = pickle.load(f) _pickle.UnpicklingError: invalid load key, '<'.

from stylegan-encoder.

pbaylies avatar pbaylies commented on July 21, 2024

I've seen this issue before; make sure you're using Python 3, that your file downloaded properly, and if that doesn't work, then try using encoding='latin1' when you load the pickled file:

pickle.load(f, encoding='latin1')

from stylegan-encoder.

B-Yassine avatar B-Yassine commented on July 21, 2024

I tried what you suggested but it doesn't work. I am getting the same error.

File "encode_images.py", line 116, in main generator_network, discriminator_network, Gs_network = pickle.load(f, encoding='latin1') _pickle.UnpicklingError: invalid load key, '<'.

from stylegan-encoder.

pbaylies avatar pbaylies commented on July 21, 2024

Then make sure the file is correct; good luck!

from stylegan-encoder.

B-Yassine avatar B-Yassine commented on July 21, 2024

I solved it, but i am struggling with that one now :|

Exception ignored in: <bound method tqdm.__del__ of yassine2_01: loss 103.8618; lr 0.0051: 12% 12/100 [00:17<01:06, 1.33it/s]> Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 931, in __del__ self.close() File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 1133, in close self._decr_instances(self) File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 496, in _decr_instances cls.monitor.exit() File "/usr/local/lib/python3.6/dist-packages/tqdm/_monitor.py", line 52, in exit self.join() File "/usr/lib/python3.6/threading.py", line 1053, in join raise RuntimeError("cannot join current thread") RuntimeError: cannot join current thread

It is a big problem when you don't have enough ressources.

from stylegan-encoder.

pbaylies avatar pbaylies commented on July 21, 2024

Oh interesting, I never would have guessed that; glad you figured it out!

from stylegan-encoder.

jkyndir avatar jkyndir commented on July 21, 2024

I tried what you suggested but it doesn't work. I am getting the same error.

File "encode_images.py", line 116, in main generator_network, discriminator_network, Gs_network = pickle.load(f, encoding='latin1') _pickle.UnpicklingError: invalid load key, '<'.

Hi there. I'm having the same problem with the "invalid load key" in the google colab.
Could you enlighten me with how you solved that problem ?
Much thx.

from stylegan-encoder.

jkyndir avatar jkyndir commented on July 21, 2024

Never mind. I figured it out.
I used the shareable link, not the download url to the file.
THX.

from stylegan-encoder.

sathish-rajendran avatar sathish-rajendran commented on July 21, 2024

can you please elaborate how you solved it?

from stylegan-encoder.

HenrySaba avatar HenrySaba commented on July 21, 2024

Hi, I used the shareable link to the file and I'm still facing this issue:

Traceback (most recent call last): File "encode_images.py", line 247, in <module> main() File "encode_images.py", line 122, in main generator_network, discriminator_network, Gs_network = pickle.load(f) _pickle.UnpicklingError: invalid load key, '<'.

Some elaboration on a solution would be highly appreciated. I'm on Python 3.6.9

from stylegan-encoder.

Zeltserj avatar Zeltserj commented on July 21, 2024

Hi, I've tried everything on this post and searched the internet, yet nothing woks. When I run encode_images.py with the default URL it throws a quota exceeded error. when I put a different URL (for say the copy I made for myself) I get the pickling error:

Traceback (most recent call last):
  File "encode_images.py", line 241, in <module>
    main()
  File "encode_images.py", line 116, in main
    generator_network, discriminator_network, Gs_network = pickle.load(f, encoding='latin1')
_pickle.UnpicklingError: invalid load key, '<'.

If anyone solved this or has a link to a working pretrained model I'd highly appreciate it

from stylegan-encoder.

YanaHrytsenko avatar YanaHrytsenko commented on July 21, 2024

I have same issue.

from stylegan-encoder.

Ani1211999 avatar Ani1211999 commented on July 21, 2024

I have same issue but my laptop doesn't have GPU any way I can perform it on colab only.I am using only 3 images for my purpose.

from stylegan-encoder.

Ani1211999 avatar Ani1211999 commented on July 21, 2024

but still it is giving

from stylegan-encoder.

utaccn avatar utaccn commented on July 21, 2024

Hi, I've tried everything on this post and searched the internet, yet nothing woks. When I run encode_images.py with the default URL it throws a quota exceeded error. when I put a different URL (for say the copy I made for myself) I get the pickling error:

Traceback (most recent call last):
  File "encode_images.py", line 241, in <module>
    main()
  File "encode_images.py", line 116, in main
    generator_network, discriminator_network, Gs_network = pickle.load(f, encoding='latin1')
_pickle.UnpicklingError: invalid load key, '<'.

If anyone solved this or has a link to a working pretrained model I'd highly appreciate it

I have the same issue

from stylegan-encoder.

nhorton04 avatar nhorton04 commented on July 21, 2024

Has anyone figured this out? I somehow got this all to work a while ago but I forget what I did, and have reinstalled my OS since then. Very frustrating issue. I am in the exact same position as @utaccn

from stylegan-encoder.

utaccn avatar utaccn commented on July 21, 2024

I gave up and I did use stylegan2 @nhorton04

from stylegan-encoder.

serarmani avatar serarmani commented on July 21, 2024

Has anyone figured this out? I somehow got this all to work a while ago but I forget what I did, and have reinstalled my OS since then. Very frustrating issue. I am in the exact same position as @utaccn

Once you have a link it looks like this:
https://drive.google.com/file/d/1wTczzzzzzzzzzzzzzzzzzzzzzycaBq8Or/view?usp=sharing
there are 3 changes that you should do before being able to share that file:
1- change the pickle.load(f) to pickle.load(f, encoding='latin1')
2- change the shareable link to: https://drive.google.com/uc?id=1wTczzzzzzzzzzzzzzzzcaBq8Or
pay attention we modify 2 parts: a) uc?id= && b)delete the last part
3- make sure your link is changed to be shared with anyone from your google drive settings
good luck

from stylegan-encoder.

agountis avatar agountis commented on July 21, 2024

I have same issue but my laptop doesn't have GPU any way I can perform it on colab only.I am using only 3 images for my purpose.

here is what you need to do:
1- download the pickle file manually (from the link that the error already shows)
2- upload it to your google drive
3- change the sharing option from only you to anyone with the link.
4- generate and copy the sharing link from of uploaded file from your google drive
5- in the link change the file/d/ part to uc?id=
6- delete the ending part (/view?usp=sharing)
7- from file tab of your colab notebook, find and click on encode_images.py
8- on the right side of your browser the code will open. find the parsers sections
9- find the line which gives the default url to load the pickle file: parser.add_argument('--model_url', default=
10- change the url to what we created in the previous steps.
thats it.

@serarmani
This worked really well.
However, I'd make this suggestion:
Instead of modifying the encode_images.py file, use the command line flag instead.
Modify (from the fast version):
!python encode_images.py --optimizer=lbfgs --face_mask=True --iterations=6 --use_lpips_loss=0 --use_discriminator_loss=0 --output_video=True aligned_images/ generated_images/ latent_representations/

to be:
!python encode_images.py --model_url=ADD_LINK_HERE --optimizer=lbfgs --face_mask=True --iterations=6 --use_lpips_loss=0 --use_discriminator_loss=0 --output_video=True aligned_images/ generated_images/ latent_representations/

Obviously, change ADD_LINK_HERE to be the google drive link you created in the previous step. No quotes needed.

from stylegan-encoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.