2

I am trying to train HuggingFace Transformers NER on custom dataset with custom entities. Is it possible to define custom entities in HuggingFace?

For examples, simpletransformers NERModel offers to define custom labels while training.

`custom_labels = ["O", "B-SPELL", "I-SPELL", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-PLACE", "I-PLACE"]

model = NERModel( "bert", "bert-cased-base", labels=custom_labels )`

Do we have something similar in HuggingFace Transformers? Or I have to look for alternatives like Spacy or SparkNLP? I really prefer HuggingFace Transformers way due to possibility to easily switch between different models.

arkoi
  • 66
  • 5
  • 1
    It is possible, you may simply follow this [Token Classification](https://huggingface.co/course/chapter7/2) chapter, provided by HuggingFace. Also, if you check the [ner source code](https://github.com/ThilinaRajapakse/simpletransformers/blob/master/simpletransformers/ner/ner_model.py) of `SimpleTransformers`, you can see that they also use HuggingFace transformers library for their tool. – Oguzhan Nov 16 '22 at 19:10

0 Answers0