It looks like the forward(self, x) method of the SqueezeNet is the one responsible for getting the output to the right shape (for you to use a Linear), not the classifier itself. Also, self.num_classes appears to be bound to the forward method as well, forcing things to be 1000D if you’re using the pretrained model.
From the source 36:
def forward(self, x):
    x = self.features(x)
    x = self.classifier(x)
    return x.view(x.size(0), self.num_classes)

I replaced the conv module responsible for producing the num_classes dimension, and also replaced the forward method. I’m not entirely sure if this is the right way of doing it though.
net = torchmodels.squeezenet1_1(pretrained=True)
net.classifier = nn.Sequential(
    nn.Dropout(p=0.5),
    nn.Conv2d(512, custom_num_classes, kernel_size=1),
    nn.ReLU(inplace=True),
    nn.AvgPool2d(13)
)
net.forward = lambda x: net.classifier(net.features(x)).view(x.size(0), custom_num_classes)