MviT how to change the number of classes

Dear all,

I am trying to use the MVIT_V2_S function in torchvision 0.14.
I wanted to load the pretrained weights on Kinetics-400, which has 400 output classes. However, my classification task only has 10 classes. I tried to pass in

torchvision.models.video.mvit_v2_s(weights=‘DEFAULT’, num_classes=10)

But received the following error: ValueError: The parameter ‘num_classes’ expected value 400 but got 10 instead.

May I know how can I fix this issue?

Link: mvit_v2_s — Torchvision main documentation

Load the original pretrained model first, then manipulate the last layer(s) as needed to adapt them to your use case. The finetuning tutorial might be a good start.