Views
No views yet
mBERT-Bengali-NER is a transformer-based Bengali NER model build with bert-base-multilingual-uncased model and Wikiann Datasets.1from transformers import AutoTokenizer, AutoModelForTokenClassification
2from transformers import pipeline
3
4tokenizer = AutoTokenizer.from_pretrained("sagorsarker/mbert-bengali-ner")
5model = AutoModelForTokenClassification.from_pretrained("sagorsarker/mbert-bengali-ner")
6
7nlp = pipeline("ner", model=model, tokenizer=tokenizer, grouped_entities=True)
8example = "আমি জাহিদ এবং আমি ঢাকায় বাস করি।"
9
10ner_results = nlp(example)
11print(ner_results)| Label ID | Label |
|---|---|
| 0 | O |
| 1 | B-PER |
| 2 | I-PER |
| 3 | B-ORG |
| 4 | I-ORG |
| 5 | B-LOC |
| 6 | I-LOC |
| Model | F1 | Precision | Recall | Accuracy | Loss |
|---|---|---|---|---|---|
| mBert-Bengali-NER | 0.97105 | 0.96769 | 0.97443 | 0.97682 | 0.12511 |