Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytorch generation error #27

Closed
loopdigga96 opened this issue Sep 25, 2019 · 2 comments
Closed

pytorch generation error #27

loopdigga96 opened this issue Sep 25, 2019 · 2 comments

Comments

@loopdigga96
Copy link

loopdigga96 commented Sep 25, 2019

Hello, i tried to run generation using pytorch

python pytorch_generation.py --model_path ./seqlen256_v1.ckpt/model.ckpt-413000.data-00000-of-00001 --print_once 

And get an exception while converting tensorflow model to pytorch:

Could not find PyTorch checkpoint
Converting weights and will store the PyTorch checkpoint as  59fb4c9fc12d31d104fd09b35e167d69
Read 200000 codes from the codes file.
2019-09-25 12:29:42.180793: W tensorflow/core/framework/allocator.cc:107] Allocation of 1262254080 exceeds 10% of system memory.
  2%|▏         | 1/48 [00:00<00:05,  8.24it/s]
Traceback (most recent call last):
  File "/home/vlad/Documents/coding/experiments/ctrl/pytorch_generation.py", line 128, in <module>
    current_layer.layernorm1.bias = str2parameter(layer_variables[0])
IndexError: list index out of range

Process finished with exit code 1

My environment:

  • python 3.6.8
  • torch 1.2.0
  • tensorflow==1.14.0
  • tensorflow-estimator==1.14.0

Also i found an error in 88 line in pytorch_generation.py. You should first encode string to get it hash

pytorch_model_hash = hashlib.md5(args.model_path.encode('utf-8')).hexdigest()

And I also have a question: Did you test your solution on python3?

@keskarnitish
Copy link
Contributor

Should be fixed in c5bf600

Along with the encoding issue, the Python3 filter function was behaving differently to the Python2 one.

Please reopen if problem persists.

@loopdigga96
Copy link
Author

@keskarnitish ok i will alter those lines and try again, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants