OSError: [Errno 22] Invalid argument when using torch.load
I am trying to load my dataset and it was working before but all of the sudden this error started pooping up.
When I try to load it like this:
  train_set = Database_load(root = &quot;C:\\Users\\Public\\PhysNet\\&quot;,train = &quot;train.pth&quot;)

It gives me the following error:

  File &quot;C:\Users\Public\Lucas\PhysNet\modt.py&quot;, line 185, in &lt;module&gt;
    train_set = Database_load(root = &quot;C:\\Users\\Public\\Lucas\\PhysNet\\&quot;,train = &quot;train.pth&quot;)

  File &quot;C:\Users\Public\Lucas\PhysNet\database_load.py&quot;, line 21, in __init__
    self.data, self.y1, self.y2= torch.load(os.path.join(self.root, self.train))

  File &quot;C:\ProgramData\Anaconda3\envs\project\lib\site-packages\torch\serialization.py&quot;, line 386, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)

  File &quot;C:\ProgramData\Anaconda3\envs\project\lib\site-packages\torch\serialization.py&quot;, line 580, in _load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)

OSError: [Errno 22] Invalid argument


I have tried doing the following as well when entering the path but it has not worked:
  train_set = Database_load(root = r&quot;C:\\Users\\Public\\PhysNet\\&quot;,train = &quot;train.pth&quot;)

  train_set = Database_load(root = r'C:/Users/Public/PhysNet/',train = 'train.pth')

Any suggestions on how to fix this issue?

This was a known issue (Issue#26998 and Issue#) caused by PR#20900. The problem happens because you're trying to load a file larger than 2GB, and it is specific to Windows in which &quot;sizeof(long)=4 for both 32-bit and 64-system systems&quot;. This issue was fixed by PR#27069 and is only available in PyTorch 1.3+. Therefore, to fix this issue, please upgrade your PyTorch version.
