AttributeError: 'TFBertModel' object has no attribute 'parameters'

Viewed 21

Hello I am trying to train a Bert Model for a tokenizer I had trained. I imported

from transformers import TFBertModel

model = TFBertModel.from_pretrained("bert-base-uncased")

Now I am trying to initialise the training by defining the Optimizer like this

from transformers import AdamW

optimizer = AdamW(model.parameters(), lr=5e-5)

However I am getting the following error


AttributeError Traceback (most recent call last) in 1 from transformers import AdamW 2 ----> 3 optimizer = AdamW(model.parameters(), lr=5e-5)

AttributeError: 'TFBertModel' object has no attribute 'parameters'

Following a tutorial on Youtube

https://www.youtube.com/watch?v=04oZ2P0uvp0&t=1501s&ab_channel=code_your_own_AI

0 Answers
Related