成功解决OSError: [Errno 22] Invalid argument: ‘checkpoints\20211211.pth.tar‘

简介: 成功解决OSError: [Errno 22] Invalid argument: ‘checkpoints\20211211.pth.tar‘

目录

解决问题

解决思路

解决方法


解决问题

checkpoint = torch.load(checkpoint_path)

 File "F:\File_Anaconda\project_py37\envs\lib\site-packages\torch\serialization.py", line 366, in load

   f = open(f, 'rb')

OSError: [Errno 22] Invalid argument: 'checkpoints\20211211.pth.tar'

解决思路

操作系统错误:[Errno 22]无效参数

解决方法

路径符号写错!

checkpoint_path  = 'checkpoints\20211211.pth.tar'

改为

checkpoint_path  = 'checkpoints/20211211.pth.tar'

哈哈,大功告成!


相关文章
|
NoSQL Linux
gdb调试产生code文件以及遇到的“file format not recognized”问题解决
gdb调试产生code文件以及遇到的“file format not recognized”问题解决
940 0
成功解决OSError: Unable to open file (truncated file: eof = 8388608, sblock->base_addr = 0, stored_eof =
成功解决OSError: Unable to open file (truncated file: eof = 8388608, sblock->base_addr = 0, stored_eof =
成功解决OSError: Unable to open file (truncated file: eof = 8388608, sblock->base_addr = 0, stored_eof =
|
6月前
|
Python
.repo/repo/main.py“, line 79 file=sys.stderr) SyntaxError: invalid syntax
.repo/repo/main.py“, line 79 file=sys.stderr) SyntaxError: invalid syntax
172 0
|
6月前
|
Python
【报错】Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/METADATA‘
【报错】Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/METADATA‘
201 0
|
PyTorch 算法框架/工具
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
216 0
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=405 error=11 : invalid argument
error: invalid argument ‘-std=gnu++98‘ not allowed with ‘C‘
error: invalid argument ‘-std=gnu++98‘ not allowed with ‘C‘
116 0
|
Linux
WARNING: Re-reading the partition table failed with error 22: Invalid argument
在划分磁盘分区时,遇到错误“WARNING: Re-reading the partition table failed with error 22: Invalid argument” 如下所示: [root@DB-Server u02]# fdisk -l   Disk /dev/sda: 500.
2543 0
|
Python
FileNotFoundError: [Errno 2] No such file or directory
FileNotFoundError: [Errno 2] No such file or directory
730 0
FileNotFoundError: [Errno 2] No such file or directory
ERROR: Could not install packages due to an Oserror: [Errno 13] Permission denied: RECORD Consider
ERROR: Could not install packages due to an Oserror: [Errno 13] Permission denied: RECORD Consider
1103 0
ERROR: Could not install packages due to an Oserror: [Errno 13] Permission denied: RECORD Consider