ok, clear.
The pre-trained layer you are using has dimensions [1000, 1536], the ideas that come to mind are 3:

if you really need that pre-trained layer you could add an intermediate layer in the sequential in order to re-expand the output as:

model = torch.nn.Sequential(model,torch.nn.Linear(384,1536),
                            linear_classifier)


although, in this case you would still have to re-train the network a bit to tune the parameters of the new layer.

As in my previous answer, you can remove these two lines

state_dict = torch.hub.load_state_dict_from_url(url="https://dl.fbaipublicfiles.com/dino/dino_deitsmall8_pretrain/dino_deitsmall8_linearweights.pth")['state_dict']
linear_classifier.load_state_dict(state_dict, strict=True)

and just use a new layer which you have to train
linear_classifier = LinearClassifier(384, 1000)


You can create a new dictionary with just part of the weights that you have:

new_state_dict = {}
new_state_dict["module.linear.bias"] = state_dict["module.linear.bias"][0:384]
new_state_dict["module.linear.weight"] = state_dict["module.linear.weight"][0:384]

where you can take any set of 384 values (e.g. 1:385, 2:386 etc.). Anyway I don’t see the point in doing this, since you should probably fine-tune these weights again