question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using cache when loading vocab.Vectors on Windows gives OSError Invalid Argument error

See original GitHub issue

I was trying to load fasttext common-crawl vector (.vec.gz) file into torchtext by using torchtext.vocab.Vectors emb = vocab.Vectors(name=fasttext_name, url=URL, cache=fasttext_cache) For the first time without the .pt file, loading the vectors works fine and it creates<filename> .pt file on the cache folder. However, whenever I load the vector again when the .pt file exists in the folder, it gives this kind of error:

 File "load_emb.py", line 94, in get_fasttext_embs
    name=fasttext_name, url=URL, cache=fasttext_cache
  File "C:\Users\user\Anaconda3\lib\site-packages\torchtext\vocab.py", line 323, in __init__
    self.cache(name, cache, url=url, max_vectors=max_vectors)
  File "C:\Users\user\Anaconda3\lib\site-packages\torchtext\vocab.py", line 432, in cache
    self.itos, self.stoi, self.vectors, self.dim = torch.load(path_pt)
  File "C:\Users\user\Anaconda3\lib\site-packages\torch\serialization.py", line 386, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "C:\Users\user\Anaconda3\lib\site-packages\torch\serialization.py", line 580, in _load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
OSError: [Errno 22] Invalid argument

I don’t have this error when I run the same code inside a linux machine. I wonder what can I do to fix this on Windows machine since I need to delete the .pt file and starts loading fasttext vector from the start again every time I need to run the code.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mattr1commented, Oct 3, 2019

Okay, looks like a known issue with pytorch 1.2: https://github.com/pytorch/pytorch/issues/26998

0reactions
zhangguanheng66commented, Jun 16, 2020

Feel free to re-open the issue if you still have the question.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError [Errno 22] invalid argument when use open() in Python
In my case the error was due to lack of permissions to the folder path. I entered and saved the credentials ...
Read more >
Bug listing with status CONFIRMED as at 2022/12/20 18:46:38
Bug :4315 - "[Future EAPI] add support for version ranges in DEPEND" ... from windows driver for prism54 based cards" status:CONFIRMED resolution: severity: ......
Read more >
[Solved] OSError errno22 invalid argument - Python Pool
OSError errno22 invalid argument is raised when the error occurs due to some system failure, full disk or the file cannot be found....
Read more >
Text Generation With LSTM Recurrent Neural Networks in ...
Generative models like this are useful not only to study how well a model has learned a problem but also to learn more...
Read more >
textacy Documentation - Read the Docs
For most uses of textacy, language-specific model data in spaCy is ... it caches the loaded language data to minimize wait time and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found