The error is most likely raised as you are trying to use the pretrained model, while also specifying another number of classes.
You could remove the **classes argument to load the “standard” pretrained model with 1000 output classes and replace the last fully connected layer:
resnet152_model = resnet.resnet152(pretrained=True)
resnet152_model.fc = nn.Linear(2048, 9170)