Torch.save triggers error when saving model

einrone: <p>I am getting the following error code:</p>
<p>Traceback (most recent call last):<br>
File “/home/arams/anaconda3/lib/python3.8/site-packages/torch/serialization.py”, line 372, in save<br>
_save(obj, opened_zipfile, pickle_module, pickle_protocol)<br>
File “/home/arams/anaconda3/lib/python3.8/site-packages/torch/serialization.py”, line 478, in _save<br>
zip_file.write_record(‘data.pkl’, data_value, len(data_value))<br>
OSError: [Errno 28] No space left on device</p>
<p>During handling of the above exception, another exception occurred:</p>
<p>Traceback (most recent call last):<br>
File “/home/arams/anaconda3/lib/python3.8/site-packages/torch/serialization.py”, line 373, in save<br>
return<br>
File “/home/arams/anaconda3/lib/python3.8/site-packages/torch/serialization.py”, line 259, in <strong>exit</strong><br>
self.file_like.write_end_of_file()<br>
RuntimeError: [enforce fail at inline_container.cc:274] . unexpected pos 64 vs 0</p>
<p>During handling of the above exception, another exception occurred:</p>
<p>Traceback (most recent call last):<br>
File “train.py”, line 499, in <br>
run()<br>
File “train.py”, line 309, in <strong>call</strong><br>
self.<em>validate</em>(current_epoch, validation_loader)<br>
File “train.py”, line 253, in <em>validate</em><br>
self.save_network(prev_score, current_score, epoch, current_lr)<br>
File “train.py”, line 141, in save_network<br>
torch.save(state_dict, savepath)<br>
File “/home/arams/anaconda3/lib/python3.8/site-packages/torch/serialization.py”, line 374, in save<br>
_legacy_save(obj, opened_file, pickle_module, pickle_protocol)<br>
File “/home/arams/anaconda3/lib/python3.8/site-packages/torch/serialization.py”, line 214, in <strong>exit</strong><br>
self.file_like.close()<br>
OSError: [Errno 28] No space left on device<br>
terminate called after throwing an instance of ‘c10::Error’<br>
what():  [enforce fail at inline_container.cc:274] . unexpected pos 64 vs 0<br>
frame <span class="hashtag">#0:</span> c10::ThrowEnforceNotMet(char const*, int, char const*, std::string const&amp;, void const*) + 0x47 (0x7f78209ae0e7 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libc10.so)<br>
frame <span class="hashtag">#1:</span>  + 0x1dd5620 (0x7f786668c620 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so)<br>
frame <span class="hashtag">#2:</span>  + 0x1dd17f3 (0x7f78666887f3 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so)<br>
frame <span class="hashtag">#3:</span> caffe2::serialize::PyTorchStreamWriter::writeRecord(std::string const&amp;, void const*, unsigned long, bool) + 0xa9 (0x7f786668cf99 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so)<br>
frame <span class="hashtag">#4:</span> caffe2::serialize::PyTorchStreamWriter::writeEndOfFile() + 0xe1 (0x7f786668dad1 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so)<br>
frame <span class="hashtag">#5:</span> caffe2::serialize::PyTorchStreamWriter::~PyTorchStreamWriter() + 0x115 (0x7f786668e2c5 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so)<br>
frame <span class="hashtag">#6:</span>  + 0x734373 (0x7f786d879373 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_python.so)<br>
frame <span class="hashtag">#7:</span>  + 0x366610 (0x7f786d4ab610 in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_python.so)<br>
frame <span class="hashtag">#8:</span>  + 0x36787e (0x7f786d4ac87e in /home/arams/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_python.so)<br>
<br>
frame <span class="hashtag">#21:</span> __libc_start_main + 0xf3 (0x7f789382d0b3 in /lib/x86_64-linux-gnu/libc.so.6)</p>
<p>Aborted (core dumped)</p>
<p>A bit unsure how to fix this. It says no OSError: [Errno 28] No space left on device, but when I comment out torch.save, the programs works fine.</p>

ptrblck: <p>The error message shows that your device doesn’t have enough space so that you won’t be able to save anything on it.<br>
Create new space on it by deleting unwanted files and rerun the script.</p>