Looking at the source code of BertForMaskedLM 33, the base model is the “bert” attribute, not the “base_model” attribute. So if you want to freeze the parameters of the base model before training, you should type
for param in model.bert.parameters():
    param.requires_grad = False

instead.