Your current code looks good!
If the “filtering” would be a bit complicated, you could use Python filter to remove the model.fc layer by name, but in your use case I’m not sure there is a faster or more elegant way of passing others to the optimizer.