when i try to call torch.save to save my model in a name, it rises a FileNotFoundError. the trace back is as follow:
Traceback (most recent call last):
File "D:\python\RDANET\models\RDAnet.py", line 236, in <module>
model.save()
File "D:\python\RDANET\models\RDAnet.py", line 173, in save
t.save(self.state_dict(), name)
File "d:\anaconda3\lib\site-packages\torch\serialization.py", line 369, in save
with _open_file_like(f, 'wb') as opened_file:
File "d:\anaconda3\lib\site-packages\torch\serialization.py", line 234, in _open_file_like
return _open_file(name_or_buffer, mode)
File "d:\anaconda3\lib\site-packages\torch\serialization.py", line 215, in __init__
super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'D:/python/RDANET/checkpoints/RDAnet_0718_16_30_44.pkl'
I’m running code on a Windows remote desktop,the code:
def save(self, name=None):
if name is None:
prefix = 'D:/python/RDANET/checkpoints/' + self.model_name + '_'
name = time.strftime(prefix + '%m%d_%H_%M_%S.pkl')
t.save(self.state_dict(), name)
return name
model.save()