AliFartout
commited on
Commit
•
a0ec08a
1
Parent(s):
8a1872e
Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# NER Model using Roberta
|
3 |
+
|
4 |
+
|
5 |
+
This markdown presents a Robustly Optimized BERT Pretraining Approach (RoBERTa) model trained on a combination of two diverse datasets for two languages: English and Persian. The English dataset used is [CoNLL 2003](), while the Persian dataset is [PEYMA-ARMAN-Mixed](), a fusion of the "PEYAM" and "ARMAN" datasets, both popular for Named Entity Recognition (NER) tasks.
|
6 |
+
|
7 |
+
The model training pipeline involves the following steps:
|
8 |
+
|
9 |
+
Data Preparation: Cleaning, aligning, and mixing data from the two datasets.
|
10 |
+
Data Loading: Loading the prepared data for subsequent processing.
|
11 |
+
Tokenization: Utilizing tokenization to prepare the text data for model input.
|
12 |
+
Token Splitting: Handling token splitting (e.g., "jack" becomes "_ja _ck") and using "-100" for optimization and ignoring certain tokens.
|
13 |
+
Model Reconstruction: Adapting the RoBERTa model for token classification in NER tasks.
|
14 |
+
Model Training: Training the reconstructed model on the combined dataset and evaluating its performance.
|
15 |
+
The model's performance, as shown in the table below, demonstrates promising results:
|
16 |
+
| Epoch | Training Loss | Validation Loss | F1 | Recall | Precision | Accuracy |
|
17 |
+
|:-------:|:--------:|:--------:|:----------:|:--------------:|:----------:|:----------------:|
|
18 |
+
| 1 | 0.072600 | 0.038918 | 89.5% | 0.906680 | 0.883703 | 0.987799 |
|
19 |
+
| 2 | 0.027600 | 0.030184 | 92.3% | 0.933840 | 0.915573 | 0.991334 |
|
20 |
+
| 3 | 0.013500 | 0.030962 | 94% | 0.946840 | 0.933740 | 0.992702 |
|
21 |
+
| 4 | 0.006600 | 0.029897 | 94.8% | 0.955207 | 0.941990 | 0.993574 |
|
22 |
+
|
23 |
+
The model achieves an impressive F1-score of almost 95%.
|
24 |
+
|
25 |
+
To use the model, the following Python code snippet can be employed:
|
26 |
+
|
27 |
+
```python
|
28 |
+
from transformers import AutoConfig, AutoTokenizer, AutoModel
|
29 |
+
|
30 |
+
config = AutoConfig.from_pretrained("AliFartout/Roberta-fa-en-ner")
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained("AliFartout/Roberta-fa-en-ner")
|
32 |
+
model = AutoModel.from_pretrained("AliFartout/Roberta-fa-en-ner")
|
33 |
+
```
|
34 |
+
|
35 |
+
By following this approach, you can seamlessly access and incorporate the trained multilingual NER model into various Natural Language Processing tasks.
|