"Missing key(s) in state_dict: "features.0.weight" ..." Error exporting VGG19 to ONNX

While attempting to convert PyTorch VGG19 model to onnx with a weighed Pre-trained checkpoint from https://drive.google.com/drive/folders/1PyQJmkdCsAkOYwUyaj_l-l0as-iLDgeH

Specifically the vox-cpk.pth.tar. I think it’s a vgg19 because that’s but I am not a 100% sure.

my code:

import torch
from vgg_pytorch import VGG
from torch.autograd import Variable
import torchvision.models as models

dummy_input = torch.randn(16, 3, 224, 224)

model = models.vgg19(pretrained=False)

#I am running on a MBP. I can run it on Google Colab if needed
state_dict = torch.load('./vox-cpk.pth.tar',  map_location=torch.device('cpu')) 


torch.onnx.export(model, dummy_input, "demo19.onnx", verbose=True)

Error message:

Traceback (most recent call last):
  File "export2onnx.py", line 12, in <module>
  File "/Users/MYNAME/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 847, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for VGG:
	Missing key(s) in state_dict: "features.0.weight", "features.0.bias", "features.2.weight", "features.2.bias", "features.5.weight", "features.5.bias", "features.7.weight", "features.7.bias", "features.10.weight", "features.10.bias", "features.12.weight", "features.12.bias", "features.14.weight", "features.14.bias", "features.16.weight", "features.16.bias", "features.19.weight", "features.19.bias", "features.21.weight", "features.21.bias", "features.23.weight", "features.23.bias", "features.25.weight", "features.25.bias", "features.28.weight", "features.28.bias", "features.30.weight", "features.30.bias", "features.32.weight", "features.32.bias", "features.34.weight", "features.34.bias", "classifier.0.weight", "classifier.0.bias", "classifier.3.weight", "classifier.3.bias", "classifier.6.weight", "classifier.6.bias". 
	Unexpected key(s) in state_dict: "discriminator", "kp_detector", "optimizer_discriminator", "optimizer_kp_detector", "epoch", "generator", "optimizer_generator". 

My goal:
is to convert the first-order-motion project into ONNX then into CoreML to deploy this https://github.com/AliaksandrSiarohin/first-order-model but on iOS.

Based on the error message it seems the loaded object doesn’t hold the model’s state_dict only, but:

"discriminator", "kp_detector", "optimizer_discriminator", "optimizer_kp_detector", "epoch", "generator", "optimizer_generator"

I guess discriminator and generator might be the keys for state_dicts, but based on their name I don’t think they are used in a “normal” VGG model.