Error when save model

I use pytorch0.4 version, Sometimes an error occurs when I call to save model. but most of the time it is OK。

Traceback (most recent call last):
  File "", line 263, in <module>
  File "", line 254, in test
    }, is_best, checkpoint=args.checkpoint)
  File "", line 38, in save_checkpoint, filepath)
  File "/usr/local/python3/lib/python3.6/site-packages/torch/", line 161, in save
    return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
  File "/usr/local/python3/lib/python3.6/site-packages/torch/", line 118, in _with_file_like
    return body(f)
  File "/usr/local/python3/lib/python3.6/site-packages/torch/", line 161, in <lambda>
    return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
  File "/usr/local/python3/lib/python3.6/site-packages/torch/", line 238, in _save
    serialized_storages[key]._write_file(f, _is_real_file(f))
RuntimeError: cuda runtime error (63) : OS call failed or operation not supported on this OS at /pytorch/torch/csrc/generic/serialization.cpp:17

This error came up on macOS a while ago. Apparently updating from 10.11 to 10.12 solved this issue. Would that work for you too or are you using another OS?

I use a custom version of centos, and densenet occurs most frequently

Is there any way to avoid this error?

I’m not familiar with CentOS and googling for this error only showed some error related to macOS.
Were you able to call this code before, i.e. did you change something in your setup?
Is the GPU recognized and were you able to run CUDA examples?
Also, could you try to update PyTorch? Version 0.4.0 is quite old by now so maybe this issue has been already fixed.

thanks, I’ll try again