Fine tune pytorch model on fastai

I downloaded a resnet-50 trained on an altered version of Imagenet. It has 1000 classes. I want to fine tune it for a 5-class classifier. After downloading the Pytorch model (pytorch_model) which is of type torch.nn.parallel.data_parallel.DataParallel, I set initialized learner with models.resnet50 with pretrained=False and with the dataBunch with 5 classes. Now I replaced the learn.model=pytorch_model.
I find that the head of the model remains unaltered with 1000 classes.The custom head of fastai with adaptivePooling , flatten … layers does not replace the existing head.

Any clue would be of immense help.