Runtime error on saving the module

At the very beginning, it’s still ok, but in my epoch 58, it raise an error with the information like following:

Traceback (most recent call last):
  File "main.py", line 83, in <module>
    model.save('./checkpoint/epoch{}.ckpt'.format(epoch))
  File "/home/cc/Model/SummaRuNNer/model/BasicModule.py", line 15, in save
    torch.save(self.state_dict(), path)
  File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 135, in save
    return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
  File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 117, in _with_file_like
    return body(f)
  File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 135, in <lambda>
    return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
  File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 204, in _save
    serialized_storages[key]._write_file(f)
RuntimeError: Unknown error -1

I write a BasicModule with the save function like this:

def save(self, path):
    torch.save(self.state_dict(), name)

What is wrong here? Thanks.

can you try :

model.save(’./checkpoint/epoch’+str(epoch)+’.ckpt’)

?

I find out the question, my disk is out of memory… Thanks

ahah ok :slight_smile: