you can construct one using your own defined configuration.
from transformers import BertForMaskedLM

model = BertForMaskedLM(config=config)

where in the config variable, you provide the parameters of the model - the no. of heads for attention, FCN size etc.
So you can train from scratch, but you won’t need to download its pre-trained weights and use BERT however you wish.