Unverified Commit 732c3797 authored by Rui Xu's avatar Rui Xu Committed by GitHub
Browse files

flush buffer when saving model (#232)


Co-authored-by: default avatarxurui <xurui4@sensetime.com>
parent d5f190d1
......@@ -245,5 +245,6 @@ def save_checkpoint(model, filename, optimizer=None, meta=None):
}
if optimizer is not None:
checkpoint['optimizer'] = optimizer.state_dict()
torch.save(checkpoint, filename)
# immediately flush buffer
with open(filename, 'wb') as f:
torch.save(checkpoint, f)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment