@RaLo4 Thank you for taking the time to help,
######### Instanciate model ##################
m = pretrainedmodels.densenet201(pretrained='imagenet')

children = list(m.children())
head = nn.Sequential(nn.AdaptiveAvgPool2d(1), 
                    Flatten(), 
                    nn.Linear(children[-1].in_features, 22))
model = nn.Sequential(nn.Sequential(*children[:-2]), head)   

but did not worked either.
let me dig a little bit more, keep you posted