python-3.xhuggingface-transformersbert-language-modelhuggingfacedeeppavlov

BERT model conversion from DeepPavlov to HuggingFace format


I have a folder with the ruBERT model, which was fine-tuned with the application of the Deeppavlov library.

The folder contains the following model files:

enter image description here

How do I convert it to Huggingface format so that I can load it this way?

from transformers import TFAutoModelForSequenceClassification

model_name = "folder_with_ruBERT"
auto_model_rubert = TFAutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name, do_lower_case = False)

Solution

  • There is no need to convert the tf checkpoints into huggingface format. The DeepPavlov's pretrained language models are already available as huggingface models.

    https://huggingface.co/DeepPavlov