To freeze specific layers you could access these layers manually and set the requires_grad attribute of their parameters to False:
for param in model.layer3.parameters():
    param.requires_grad_(False)

On the other hand if you want to freeze the “first 25%”, you could use the first approach and add a break statement after 25% of all parameters/layers were frozen.