I want to Freeze my RoBERTa model base layer and only train on my classification layer, but i get the following error 'TFRobertaEmbeddings' object has no attribute 'parameters'. Here is my code
import transformers
model = transformers.TFRobertaModel.from_pretrained(MODEL_NAME, from_pt=True)
for param in model.roberta.embeddings.parameters():
param.requires_grad = False
parameters
method only works forpytorch
layers, however the model you're using inherits fromtensorflow
layer. Try using thetrainable
attribute as described in the documentation as follows:model.roberta.embeddings.trainable = False
. $\endgroup$