Closed ZahraAbbasiantaeb closed 2 years ago
Hi, I am trying to load the 'tanda_bert_base_asnq' model with the following code:
config = BertConfig.from_json_file('./TANDA/BERT/tanda_bert_base_asnq/config.json')
bert = BertForPreTraining.from_pretrained('./TANDA/BERT/tanda_bert_base_asnq/model.ckpt.index', from_tf=True, config=config)
and I get the following error:
AttributeError: 'BertForPreTraining' object has no attribute 'bias'
I have used other functions like TFBertModel, TFAutoModel, and BertModel but it didn't work.
TFBertModel, TFAutoModel, and BertModel
could you please help me to solve this error?
Please try using BertForSequenceClassification.from_pretrained. Also refer to #3 when converting the TF model to pytorch model.
Thanks for the answer cosmoshsv
Hi, I am trying to load the 'tanda_bert_base_asnq' model with the following code:
config = BertConfig.from_json_file('./TANDA/BERT/tanda_bert_base_asnq/config.json')
bert = BertForPreTraining.from_pretrained('./TANDA/BERT/tanda_bert_base_asnq/model.ckpt.index', from_tf=True, config=config)
and I get the following error:
AttributeError: 'BertForPreTraining' object has no attribute 'bias'
I have used other functions like
TFBertModel, TFAutoModel, and BertModel
but it didn't work.could you please help me to solve this error?