You can freeze all parameters of the model first via:
for param in model.parameters():
    param.requires_grad_(False)

and later unfreeze the desired blocks by printing the model (via print(model)) and use the corresponding module names to unfreeze their parameters. E.g. assuming the last two “blocks” are named block1 and block2, this should work:
for param in model.block1.parameters():
    param.requires_grad_(True)
for param in model.block2.parameters():
    param.requires_grad_(True)