Torch.save error

when i call torch.save to save model in training stage. It raise OSError. The trackback is as follow:

Traceback (most recent call last):
  File "/home/ym/git/action_recognition.pytorch/tools/train.py", line 347, in <module>
    val_loss = train(epoch, best_val_loss)
  File "/home/ym/git/action_recognition.pytorch/tools/train.py", line 323, in train
    torch.save(decoder.state_dict(), decoder_file)
  File "/home/ym/anaconda2/envs/pytorch3.0-py3.5/lib/python3.5/site-packages/torch/serialization.py", line 135, in save
    return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
  File "/home/ym/anaconda2/envs/pytorch3.0-py3.5/lib/python3.5/site-packages/torch/serialization.py", line 120, in _with_file_like
    f.close()
OSError: [Errno 5] Input/output error

The environment is
Python3.5 and pytorch3.0.

What’s strange is the weight files could be saved sometimes.

1 Like

It means that Python cannot write the file to disk.
This could range from the filesystem running out of space via user quotas if you are on a machine that has them to failing storage devices.

Best regards

Thomas