Using Pretrained BERT model to add additional words that are not recognized by the model
Hello,

I want some help regarding adding additional words in the existing BERT model. I have two quires kindly guide me:

I am working on NER task for a domain:

There are few words (not sure the exact numbers) that BERT recognized as [UNK], but those entities are required for the model to recognize. The pretrained model learns well (up to 80%) accuracy on "bert-base-cased" while providing labeled data and fine-tune the model but intuitively the model will learn better if it recognize all the entities.

1. Do i need to add those unknown entities in vocabs.txt and train the model again?


2. Do i need to train the BERT model on my data from Scratch?

Thanks... 

You don't need to do either of those things! You should add tokens to your tokenizer by leveraging the `add_tokens()` method, and then resize your model's embedding matrix.

Then, you should train your model on a dataset that has those entities so that it understands the meaning of these entities. It seems to be what you're doing here, so just make sure to add the tokens to your tokenizer first. You can see the doc about it [here](https://huggingface.co/transformers/internal/tokenization_utils.html?highlight=add_tokens#transformers.tokenization_utils_base.SpecialTokensMixin.add_tokens).

Also, we try to keep the github issues only for bugs and feature requests. Please ask questions/discussions on the [instead](https://discuss.huggingface.co). Thanks!