File size: 2,499 Bytes
3ce90a8
 
09245d9
259c5c6
 
09245d9
 
 
 
 
 
 
 
 
 
 
259c5c6
3ce90a8
 
09245d9
3ce90a8
 
 
09245d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
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}},
}
```