How to load only a few parameters

I want to modify the parameters of a model

"hidden_size": 256
or
"pooler_fc_size": 256

If so, I will not be able to load the parameters of the pre-trained model completely, I want to load only part of the parameters because it is a model with modified network structure, now my plan is to load the last_hidden_states, how do I write the code? Or where is the documentation?