pytorch-book icon indicating copy to clipboard operation
pytorch-book copied to clipboard

第6章猫狗大战运行出错

Open daisutao opened this issue 6 years ago • 7 comments

File "C:\Python36\lib\site-packages\torch\serialization.py", line 209, in save

return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickl

e_protocol)) File "C:\Python36\lib\site-packages\torch\serialization.py", line 132, in _wit h_file_like f = open(f, mode) OSError: [Errno 22] Invalid argument: 'checkpoints/squeezenet_0921_10:14:29.pth'

daisutao avatar Sep 21 '18 02:09 daisutao

我知道了,生成的文件名中,不能有":“号。

daisutao avatar Sep 21 '18 13:09 daisutao

@daisutao 原来是这样,谢谢

RruceLeeLQ avatar Apr 13 '19 04:04 RruceLeeLQ

也是卡在这里,谢谢

lyc-python avatar Jul 29 '19 14:07 lyc-python

我知道了,生成的文件名中,不能有“:“号。 你好,请问生成的文件名是指哪一个?

011043 avatar Aug 20 '19 04:08 011043

也是卡在这里,谢谢

请问你是怎么解决的?不好意思我没太看懂,生成文件名指哪一个,在哪里把:删除呢?

011043 avatar Aug 22 '19 01:08 011043

也是卡在这里,谢谢

请问你是怎么解决的?不好意思我没太看懂,生成文件名指哪一个,在哪里把:删除呢?

代码中有一段涉及路径checkpoints/squeezenet_0921_10:14:29.pth 这里的时间间隔用: 把冒号改成.就能运行了

lyc-python avatar Aug 22 '19 02:08 lyc-python

原因是Windows下文件名不能包含 : (冒号)

修改basic_module.py的27行:

name = time.strftime(prefix + '%m%d_%H:%M:%S.pth')

修改为:

name = time.strftime(prefix + '%m%d_%H_%M_%S.pth')

eliasyin avatar Oct 17 '19 13:10 eliasyin