Edit model card

Named-Entity-Recognition for Persian using Transformers

Model Details

Model Description: This Named-Entity-Recognition (NER) model is designed to identify and classify named entities in Persian (Farsi) text into predefined categories such as person names, organizations, locations, dates, and more. The model is built using the Hugging Face Transformers library and fine-tuned on the PartAI/TookaBERT-Base model.

Intended Use: The model is intended for use in applications where identifying and classifying entities in Persian text is required. It can be used for information retrieval, content analysis, customer support automation, and more.

Model Architecture:

Training Data

Dataset: The model was trained on a diverse corpus of Persian text, with a training dataset of 15,000 sentences and a test dataset of 2,000 sentences, to ensure broad applicability and high accuracy.

Data Preprocessing:

  • Text normalization and cleaning were performed to ensure consistency.
  • Tokenization was done using the BERT tokenizer.

Training Procedure

Training Configuration:

  • Number of Epochs: 4
  • Batch Size: 8
  • Learning Rate: 1e-5
  • Optimizer: AdamW

Training and Validation Losses:

  • Epoch 1:
    • Loss: 0.0610
    • Validation Loss: 0.0347
  • Epoch 2:
    • Loss: 0.1363
    • Validation Loss: 0.0167
  • Epoch 3:
    • Loss: 0.0327
    • Validation Loss: 0.0125
  • Epoch 4:
    • Loss: 0.0016
    • Validation Loss: 0.0062

Hardware:

  • Training Environment: NVIDIA P100 GPU
  • Training Time: Approximately 1 hour

Model Prediction Tags

The model predicts the following tags:

  • "O"
  • "I-product"
  • "I-person"
  • "I-location"
  • "I-group"
  • "I-creative-work"
  • "I-corporation"
  • "B-product"
  • "B-person"
  • "B-location"
  • "B-group"
  • "B-creative-work"
  • "B-corporation"

How To Use

import torch
from transformers import pipeline

# Load the NER pipeline
ner_pipeline = pipeline("ner", model="NLPclass/Named-entity-recognition")

# Example text in Persian
text = "باراک اوباما در هاوایی متولد شد."

# Perform NER
entities = ner_pipeline(text)

# Output the entities
print(entities)
@misc{NLPclass,
  author = {NLPclass},
  title = {Named-Entity-Recognition for Persian using Transformers},
  year = {2024},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/NLPclass/Named-entity-recognition}},
}
Downloads last month
11
Safetensors
Model size
122M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Spaces using NLPclass/Named-entity-recognition 2