Model size is not consisitent while saving

I’m using torch.save to save my model and I find that when I save it in one file, the size is about 24 MB. while I save each parameter in a single file,the sum of the sizes is about 50MB. Why does this happen?

model = Net()
torch.save(model.state_dict(),'model.pth')
# 24 MB
model = torch.load('model.pth')
for k,v in model.items():
    torch.save(v,k+'.pth')
# sum of sizes is 50 MB

Thanks a lot.

The pickle module will most likely add some overhead for each file.
How many items are you storing?

Thanks for you reply.It’s about twenty files as I store each parameter in one file.