I think this is due to this line 25 in the original code.
Since you initialize self.layer4 twice, in super(...).__init__(...) and on the next line, this line gets called again and modifies the self.inplanes variable, which then breaks your code. I think you really need to modify the original code and not simply extend it like you have!
Another thing, since you mentioned loading a pretrained model: as you modified a dimension in the model, the shapes of the weight and bias matrices between your architecture and the pretrained model won’t agree at that location, so you will have to either take a portion of the original matrices, or remove the faulty layers altogether and finetune your network to populate them with better values than random.