CoolFace
Modelpublic

ismatsamadov/xlm-roberta-az-ner

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes152downloads
Model Card

XLM-RoBERTa Azerbaijani NER Model

![Hugging Face Model](https://huggingface.co/IsmatS/xlm-roberta-az-ner)

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

Model Details

  • —Base Model: xlm-roberta-base
  • —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

EpochTraining LossValidation LossPrecisionRecallF1
10.3231000.2755030.7757990.6948860.733117
20.2725000.2624810.7392660.7399000.739583
30.2486000.2524980.7514780.7411520.746280
40.2368000.2499680.7548820.7414490.748105
50.2238000.2521870.7643900.7404600.752235
60.2186000.2498870.7563520.7416460.748927
70.2097000.2507480.7606960.7394380.749916

Detailed Classification Report (Epoch 7)

This table summarizes the precision, recall, and F1-score for each entity type, calculated on the validation dataset.

Entity TypePrecisionRecallF1-ScoreSupport
ART0.540.200.291857
DATE0.520.470.50880
EVENT0.690.350.4796
FACILITY0.690.690.691170
LAW0.600.610.601122
LOCATION0.770.820.809132
MONEY0.610.570.59540
ORGANISATION0.690.680.69544
PERCENTAGE0.790.820.813591
PERSON0.870.830.857037
PRODUCT0.830.850.842808
TIME0.550.510.531569

Overall Metrics:

  • —Micro Average: Precision = 0.76, Recall = 0.74, F1-Score = 0.75
  • —Macro Average: Precision = 0.68, Recall = 0.62, F1-Score = 0.64
  • —Weighted Average: Precision = 0.75, Recall = 0.74, F1-Score = 0.74

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:

bash
pip install transformers

Inference Example

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

python
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

# Load the model and tokenizer
model_name = "IsmatS/xlm-roberta-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

json
[
    {
        "entity_group": "PERSON",
        "score": 0.99,
        "word": "İlham Əliyev",
        "start": 34,
        "end": 46
    },
    {
        "entity_group": "LOCATION",
        "score": 0.98,
        "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: 8
  • —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_az_ner_2024,
  title={XLM-RoBERTa Azerbaijani NER Model},
  author={Ismat Samadov},
  year={2024},
  publisher={Hugging Face},
  url={https://huggingface.co/IsmatS/xlm-roberta-az-ner}
}

License

This model is available under the MIT License.