I am facing a weird issue and i am trying to figure out why size of my save model is super big.
I have the following net:
AlexNetTransfer(
(fullnet): Sequential(
(0): Conv2d(3, 42, kernel_size=(11, 11), stride=(4, 4), padding=(2, 2))
(1): ReLU(inplace=True)
(2): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)
(3): Conv2d(42, 96, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
(4): ReLU(inplace=True)
(5): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)
(6): Conv2d(96, 190, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(7): ReLU(inplace=True)
(8): Conv2d(190, 169, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(9): ReLU(inplace=True)
(10): Conv2d(169, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): ReLU(inplace=True)
(12): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)
(13): AdaptiveAvgPool2d(output_size=(6, 6))
(14): Linear(in_features=2304, out_features=3487, bias=True)
(15): ReLU(inplace=True)
(16): Linear(in_features=3487, out_features=4096, bias=True)
(17): ReLU(inplace=True)
(18): Linear(in_features=4096, out_features=102, bias=True)
)
)
which I trained. When I use torch.save(net, 'a')
I get following warnings and the size of model is super huge: 15 GB.
/opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type AlexNetTransfer. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked " /opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type Sequential. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked " /opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type Conv2d. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked " /opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type Linear. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked " /opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type ReLU. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked " /opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type MaxPool2d. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked " /opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py:292: UserWarning: Couldn't retrieve source code for container of type AdaptiveAvgPool2d. It won't be checked for correctness upon loading. "type " + obj.__name__ + ". It won't be checked "
However if i use torch.save(net.state_dict(), 'a')
the size is just 90 mb which is reasonable. Any how to figure out what else is being saved that makes the file that big?
Thanks.