I do not think you can change the number of self attention layers in the network from the transformers library. Think about it. If you even manage to change the self attention layers number, the  dimension of data that goes into the subsequent layers will change, which will cause a problem with dimensions.
Moreover, the size of the  pre-trained weighs of the “roberta-base” is fixed, changing the any parameter(number of heads and self attention layers number), will make it not possible to load the pre-trained onto the  “roberta-base” architecture.
You can take a look  Transformer Multihead Attention