I am getting this error when I am loading the weights for a model I trained on a GPU.  I am trying to load the model on a CPU.  Not sure what this error means.  I did check the checkpoint[‘state_dict’] keys and it does contain this ‘num_batches_tracked’ key for all the batch normalization layers.  I am using the same model on the CPU as I trained on the GPU.  I am training a UNet model.
checkpoint = torch.load(‘model_best.pth-zeromask-notconsider.tar’,map_location=lambda storage, loc: storage)
train_conv.model.load_state_dict(checkpoint[‘state_dict’])
RuntimeError                              Traceback (most recent call last)
 in ()
----> 1 train_conv.model.load_state_dict(checkpoint[‘state_dict’])
~\AppData\Local\conda\conda\envs\myfastai1\lib\site-packages\torch\nn\modules\module.py in load_state_dict(self, state_dict, strict)
719         if len(error_msgs) > 0:
720             raise RuntimeError(‘Error(s) in loading state_dict for {}:\n\t{}’.format(
–> 721                                self.class.name, “\n\t”.join(error_msgs)))
722
723     def parameters(self):
RuntimeError: Error(s) in loading state_dict for Unet34:
Unexpected key(s) in state_dict: “rn.1.num_batches_tracked”, “rn.4.0.bn1.num_batches_tracked”, “rn.4.0.bn2.num_batches_tracked”, “rn.4.1.bn1.num_batches_tracked”, “rn.4.1.bn2.num_batches_tracked”, “rn.4.2.bn1.num_batches_tracked”, “rn.4.2.bn2.num_batches_tracked”, “rn.5.0.bn1.num_batches_tracked”, “rn.5.0.bn2.num_batches_tracked”, “rn.5.0.downsample.1.num_batches_tracked”, “rn.5.1.bn1.num_batches_tracked”, “rn.5.1.bn2.num_batches_tracked”, “rn.5.2.bn1.num_batches_tracked”, “rn.5.2.bn2.num_batches_tracked”, “rn.5.3.bn1.num_batches_tracked”, “rn.5.3.bn2.num_batches_tracked”, “rn.6.0.bn1.num_batches_tracked”, “rn.6.0.bn2.num_batches_tracked”, “rn.6.0.downsample.1.num_batches_tracked”, “rn.6.1.bn1.num_batches_tracked”, “rn.6.1.bn2.num_batches_tracked”, “rn.6.2.bn1.num_batches_tracked”, “rn.6.2.bn2.num_batches_tracked”, “rn.6.3.bn1.num_batches_tracked”, “rn.6.3.bn2.num_batches_tracked”, “rn.6.4.bn1.num_batches_tracked”, “rn.6.4.bn2.num_batches_tracked”, “rn.6.5.bn1.num_batches_tracked”, “rn.6.5.bn2.num_batches_tracked”, “rn.7.0.bn1.num_batches_tracked”, “rn.7.0.bn2.num_batches_tracked”, “rn.7.0.downsample.1.num_batches_tracked”, “rn.7.1.bn1.num_batches_tracked”, “rn.7.1.bn2.num_batches_tracked”, “rn.7.2.bn1.num_batches_tracked”, “rn.7.2.bn2.num_batches_tracked”, “up1.bn.num_batches_tracked”, “up2.bn.num_batches_tracked”, “up3.bn.num_batches_tracked”, “up4.bn.num_batches_tracked”.