How to freeze parts of T5 model

I know that T5 has K, Q and V vectors in each layer. It also has a feedforward network. I would like to freeze only feedforward layers on each layer of T5. Could you please guide me how can I do this?

I asked the question on StackOverflow and it had an easy answer. It seems people there are more helpful.