For example, I want to train a BERT model from scratch but using the existing configuration. Is the following code the correct way to do so?
model = BertModel.from_pretrained('bert-base-cased')
model.init_weights()
Because I think the init_weights method will re-initialize all the weights.
Second question, if I want to change a bit the configuration, such as the number of hidden layers.
model = BertModel.from_pretrained('bert-base-cased', num_hidden_layers=10)
model.init_weights()
I wonder if the above is the correct way to do so. Because they don't appear to have an error when I run the above code.