Partially freezing and unfreezing the network when required

I’m currently working on a CNN project using resnet18. I replaced the fully connected layers as per my requirement, but before doing this I set the requires_grad parameter to False for all the layers in the resnet18 model. Now what I want to do is train my model for certain epochs, overfit it to a task, and then unfreeze the gradients only for the convolution part. How do I do it?
Thank You