--- library_name: transformers license: mit language: - fa tags: - named-entity-recognition - ner - nlp - transformers - persian - farsi - persian_ner - bert metrics: - accuracy pipeline_tag: token-classification --- # Hafez NER 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 [ViravirastSHZ/Hafez_Bert](https://huggingface.co/ViravirastSHZ/Hafez_Bert) 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:** - **Model Type:** Transformers-based NER - **Language:** Persian (fa) - **Base Model:** [ViravirastSHZ/Hafez_Bert](https://huggingface.co/ViravirastSHZ/Hafez_Bert) ## Training Data **Dataset:** The model was trained on a diverse corpus of Persian text, with a training dataset of 23,000 **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:** 3 - **Batch Size:** 8 - **Learning Rate:** 1e-5 - **Optimizer:** AdamW **Hardware:** - **Training Environment:** NVIDIA P100 GPU - **Training Time:** Approximately 1 hour ## Model Prediction Tags The model predicts the following tags: - "O" - "I-DAT" - "I-EVE" - "I-FAC" - "I-LOC" - "I-MON" - "I-ORG" - "I-PCT" - "I-PER" - "I-PRO" - "I-TIM" - "B-DAT" - "B-EVE" - "B-FAC" - "B-LOC" - "B-MON" - "B-ORG" - "B-PCT" - "B-PER" - "B-PRO" - "B-TIM" ## How To Use ```python import torch from transformers import pipeline # Load the NER pipeline ner_pipeline = pipeline("ner", model="ViravirastSHZ/Hafez-NER") # Example text in Persian text = "باراک اوباما در هاوایی متولد شد." # Perform NER entities = ner_pipeline(text) # Output the entities print(entities) ``` ```bibtex @misc{ViravirastSHZ, author = {ViravirastSHZ}, title = {Named-Entity-Recognition for Persian using Transformers}, year = {2024}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/"ViravirastSHZ/Hafez-NER}}, } ```