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

Doesn't seem to work with pytorch 2.0.1 #1

Open
blksith0 opened this issue May 29, 2023 · 2 comments
Open

Doesn't seem to work with pytorch 2.0.1 #1

blksith0 opened this issue May 29, 2023 · 2 comments

Comments

@blksith0
Copy link

This command results in this error:
translit = Translit('ml')

ℹ ml model downloading inside itranlit-models..
✔ ml model download successfull. model path itranlit-models/ml.pth
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/me/testtransliterategithubthing/venv/lib/python3.11/site-packages/itranslit/transliterate.py", line 582, in __init__
    self.model = load_pretrained(self.model, self.model_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/testtransliterategithubthing/venv/lib/python3.11/site-packages/itranslit/transliterate.py", line 525, in load_pretrained
    pretrain_dict = torch.load(weight_path, map_location=torch.device('cpu'))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/testtransliterategithubthing/venv/lib/python3.11/site-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/testtransliterategithubthing/venv/lib/python3.11/site-packages/torch/serialization.py", line 1033, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, '<'.```
@blksith0
Copy link
Author

I spent way too much time figuring out that it's not downloading the language pth file from google drive correctly because drive now shows a little "Can't scan for viruses, confirm download" type of page.

So I added this

def download_file_from_google_drive(id, destination):
    URL = "https://docs.google.com/uc?export=download"

    full_download_url = f"{URL}&id={id}"
    print("Full download link:", full_download_url)

Then manually downloaded it.

@sagorbrur
Copy link
Owner

Hi @blksith0
Is it working now or still you are getting pytorch error?

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