Your code looks alright and should work assuming you fix the attribute names.
Alternatively, you could also create a custom model by deriving from a resnet implementation in case that’s easier or cleaner.