pytorch save PermissionError: [Errno 13] Permission denied:

匿名 (未验证) 提交于 2019-12-03 01:41:02

问题:

When using torch.save as stated here, I'm getting

PermissionError: [Errno 13] Permission denied: path-to-folder

Here is the relevant code:

if isdir(Policy.checkpoint_path):                       torch.save(             {             'model_state_dict': self.state_dict(),             'optimizer_state_dict': optimizer.state_dict(),             }, 'D:\git\stav\stav-RL\policy_save') 

notice this gives the same error with any/all of the following attempts:

  • changing folder permissions
  • changing python permissions
  • working with relative path
  • changing the direcory of the script using chdir

pyorch uses pickle under the hood.

I am running on windows 10.

Please tell me how to get past that permissions problem

回答1:

This seems to be a solution for your problem

Edit:

Add name of the file at the end of the path so it would be: 'D:\git\stav\stav-RL\policy_save\model.pth'



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!