Python 2.7 - torch.save/load - unknown error


(Aang Maya) #1

`File “C:\Anaconda2\lib\site-packages\torch\serialization.py”, line 192, in _save
serialized_storages[key]._write_file(f)

RuntimeError: Unknown error`

Getting this error when using torch.save() on python 2.7 and torch 0.1.12

     torch.save({"state_dict": self.model.state_dict(),
                "optimizer" : self.optimizer.state_dict(),
               }, "last_brain.pth")

and using

checkpoint = torch.load(‘last_brain.pth’)
self.model.load_state_dict(checkpoint[‘state_dict’])
self.optimizer.load_state_dict(checkpoint[‘optimizer’])

for load… this error:

File “C:\Anaconda2\lib\site-packages\torch\serialization.py”, line 384, in _load
deserialized_objects[key]._set_from_file(f, offset)

RuntimeError: Unknown error