Edit model card

mBERT Azerbaijani NER Model

Hugging Face Model

This model is a fine-tuned version of mBERT (Multilingual BERT) for Named Entity Recognition (NER) in the Azerbaijani language. It recognizes several entity types commonly used in Azerbaijani text, providing solid performance on tasks requiring entity extraction, such as personal names, locations, organizations, and dates.

Model Details

  • Base Model: bert-base-multilingual-cased
  • Fine-tuned on: Azerbaijani Named Entity Recognition Dataset
  • Task: Named Entity Recognition (NER)
  • Language: Azerbaijani (az)
  • Dataset: Custom Azerbaijani NER dataset with entity tags such as PERSON, LOCATION, ORGANISATION, DATE, etc.

Data Source

The model was trained on the Azerbaijani NER Dataset, which provides annotated data with 25 distinct entity types specifically for the Azerbaijani language. This dataset is an invaluable resource for improving NLP tasks in Azerbaijani, including entity recognition and language understanding.

Entity Types

The model recognizes the following entities:

  • PERSON: Names of people
  • LOCATION: Geographical locations
  • ORGANISATION: Companies, institutions
  • DATE: Dates and periods
  • MONEY: Monetary values
  • TIME: Time expressions
  • GPE: Countries, cities, states
  • FACILITY: Buildings, landmarks, etc.
  • EVENT: Events and occurrences
  • ...and more

For the full list of entities, please refer to the dataset description.

Performance Metrics

Epoch-wise Performance

Epoch Training Loss Validation Loss Precision Recall F1 Accuracy
1 0.295200 0.265711 0.715424 0.622853 0.665937 0.919136
2 0.248600 0.252083 0.721036 0.637979 0.676970 0.921439
3 0.206800 0.253372 0.704872 0.650684 0.676695 0.920898

Evaluation Summary (Epoch 3)

  • Evaluation Loss: 0.253372
  • Evaluation Precision: 0.704872
  • Evaluation Recall: 0.650684
  • Evaluation F1: 0.676695
  • Evaluation Accuracy: 0.920898

Usage

You can use this model with the Hugging Face transformers library to perform NER on Azerbaijani text. Here’s an example:

Installation

Make sure you have the transformers library installed:

pip install transformers

Inference Example

Load the model and tokenizer, then run the NER pipeline on Azerbaijani text:

from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

# Load the model and tokenizer
model_name = "IsmatS/mbert-az-ner"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

# Set up the NER pipeline
nlp_ner = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy="simple")

# Example sentence
sentence = "Bakı şəhərində Azərbaycan Respublikasının prezidenti İlham Əliyev."
entities = nlp_ner(sentence)

# Display entities
for entity in entities:
    print(f"Entity: {entity['word']}, Label: {entity['entity_group']}, Score: {entity['score']}")

Sample Output

[
    {
        "entity_group": "PERSON",
        "score": 0.97,
        "word": "İlham Əliyev",
        "start": 34,
        "end": 46
    },
    {
        "entity_group": "LOCATION",
        "score": 0.95,
        "word": "Bakı",
        "start": 0,
        "end": 4
    }
]

Training Details

  • Training Data: This model was fine-tuned on the Azerbaijani NER Dataset with 25 entity types.
  • Training Framework: Hugging Face transformers
  • Optimizer: AdamW
  • Epochs: 3
  • Batch Size: 64
  • Evaluation Metric: F1-score

Limitations

  • The model is trained specifically for the Azerbaijani language and may not generalize well to other languages.
  • Certain rare entities may be misclassified due to limited training data in those categories.

Citation

If you use this model in your research or application, please consider citing:

@model{ismats_mbert_az_ner_2024,
  title={mBERT Azerbaijani NER Model},
  author={Ismat Samadov},
  year={2024},
  publisher={Hugging Face},
  url={https://huggingface.co/IsmatS/mbert-az-ner}
}

License

This model is available under the MIT License.

Downloads last month
4
Safetensors
Model size
177M params
Tensor type
F32
·
Inference Examples
Unable to determine this model's library. Check the docs .

Dataset used to train IsmatS/mbert-az-ner

Evaluation results