Thanks for the suggestions @ptrblck. I’m trying to use torchvision.models but I think I need to modify my model class.
When I replace the line
self.model =  pretrainedmodels.__dict__['resnet18'](pretrained='imagenet')
with
self.model =  models.resnet18(pretrained=True)
I get the following error:

AttributeError: ‘ResNet’ object has no attribute ‘features’