I am trying to import BertModel from transformers, but it fails. This is code I am using
from transformers import BertModel, BertForMaskedLM
This is the error I get
ImportError: cannot import name 'BertModel' from 'transformers'
Can anyone help me fix this?
Fixed the error. This is the code
from transformers.modeling_bert import BertModel, BertForMaskedLM
lastest version of transformers have fix this issue. you can use the below command
pip install --upgrade transformers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With