File size: 9,409 Bytes
341d59b c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 340f382 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 c994ca6 cf78931 340f382 cf78931 340f382 cf78931 340f382 c994ca6 cf78931 |
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
---
library_name: transformers
language: ar
pipeline_tag: text-classification
tags:
- text-classification
- intent-classification
- marbert
- egyptian-arabic
- nlu
- e-commerce
- customer-service
license: apache-2.0
---
# MARBERT for Egyptian Dialect Intent Classification (syplyd-marbert-v1)
This is a text-classification model fine-tuned from the powerful **[UBC-NLP/MARBERTv2](https://huggingface.co/UBC-NLP/MARBERTv2)** base model. It is specifically designed to understand and classify user intents written in the **Egyptian colloquial Arabic dialect**, with a strong focus on e-commerce and customer service contexts.
The model serves as a robust Natural Language Understanding (NLU) engine, capable of powering applications like chatbots, support ticket routers, and voice assistants.
## Model Details
### Model Description
This model takes a user's query in Egyptian Arabic and classifies it into one of several predefined intents, allowing an application to understand the user's goal and respond appropriately. It was developed through an iterative process of data curation, training, analysis, and refinement to achieve high accuracy and reliability on real-world use cases.
- **Developed by:** Shaza Aly
- **Model type:** `bert-for-sequence-classification`
- **Language(s) (NLP):** Arabic (specifically Egyptian Colloquial Dialect)
- **License:** Apache-2.0
- **Finetuned from model:** [UBC-NLP/MARBERTv2](https://huggingface.co/UBC-NLP/MARBERTv2)
### Model Sources
- **Repository:** [https://huggingface.co/ShazaAly/syplyd-marbert-1](https://huggingface.co/ShazaAly/syplyd-marbert-1)
## Uses
### Direct Use
This model is intended for direct inference via the Hugging Face `pipeline`. You can provide a sentence in Egyptian Arabic, and it will return the predicted intent along with a confidence score.
```python
from transformers import pipeline
# Load the model from the Hub
classifier = pipeline("text-classification", model="ShazaAly/syplyd-marbert-1")
# Example Usage
text_1 = "عايز أعرف الأوردر بتاعي هيوصل امتى؟"
result_1 = classifier(text_1)
print(f"'{text_1}' -> {result_1}")
# Expected output: [{'label': 'track_order_status', 'score': 0.99...}]
text_2 = "المنتج ده غالي، فيه بديل أرخص؟"
result_2 = classifier(text_2)
print(f"'{text_2}' -> {result_2}")
# Expected output: [{'label': 'product_alternatives' or 'cheaperYou've done it! You've gone through the entire process from data loading to training, evaluation, and finally, deployment. Excellent work.
Now, let's create the final, professional Model Card for your new model, `syplyd-marbert-v3`, based on all the work and the latest results. This Model Card will be clear, informative, and reflect the high quality of the model you've built.
---
### **How to Update Your Model Card on Hugging Face**
1. **Go to your model's page:** Find the `syplyd-marbert-1` repository on your Hugging Face profile. Since you pushed to the same `repo_name`, you'll be updating the existing one.
2. **Edit the `README.md` file:** Click on the pencil icon (Edit) next to the `README.md` file.
3. **Replace the content:** Delete everything in the editor and **copy and paste the entire content below**.
4. **Save your work:** Scroll to the bottom and click **"Commit changes"**.
---
### **Completed Model Card for `syplyd-marbert-1` (Updated Version)**
```markdown
---
library_name: transformers
language: ar
pipeline_tag: text-classification
tags:
- text-classification
- intent-classification
- marbert
- egyptian-arabic
- nlu
- e-commerce
license: apache-2.0
---
# MARBERT for Egyptian Dialect Intent Classification (v3)
This is a text-classification model fine-tuned from the powerful **[UBC-NLP/MARBERTv2](https://huggingface.co/UBC-NLP/MARBERTv2)** model. It is specifically designed to understand user intents in the **Egyptian colloquial Arabic dialect**, with a focus on e-commerce and customer service applications.
This model is the result of an iterative development process that involved data cleaning, strategic intent restructuring, and data augmentation to resolve classification ambiguities and improve overall performance.
## Model Details
### Model Description
This model is designed to be the Natural Language Understanding (NLU) core of a chatbot or a request-routing system. It takes a user's query in Egyptian Arabic and classifies it into one of several predefined intents, allowing an application to understand the user's goal and respond appropriately.
- **Developed by:** Shaza Aly
- **Model type:** `bert-for-sequence-classification`
- **Language(s) (NLP):** Arabic (specifically Egyptian Colloquial Dialect)
- **License:** Apache-2.0
- **Finetuned from model:** [UBC-NLP/MARBERTv2](https://huggingface.co/UBC-NLP/MARBERTv2)
### Model Sources
- **Repository:** [https://huggingface.co/ShazaAly/syplyd-marbert-1](https://huggingface.co/ShazaAly/syplyd-marbert-1)
## Uses
### Direct Use
This model is intended to be used directly for inference via the Hugging Face `pipeline` or Inference API. You can provide a sentence in Egyptian Arabic, and it will return the predicted intent along with a confidence score.
```python
from transformers import pipeline
# Load the model from the Hub
classifier = pipeline("text-classification", model="ShazaAly/syplyd-marbert-1")
# Example Usage
text_1 = "عايز أعرف الأوردر بتاعي هيوصل امتى؟"
result_1 = classifier(text_1)
print(f"'{text_1}' -> {result_1}")
# Expected output: [{'label': 'track_order_status', 'score': 0.99...}]
text_2 = "المنتج ده غالي، فيه بديل أرخص؟"
result_2 = classifier(text_2)
print(f"'{text_2}' -> {result_2-commerce Chatbots:** Understand user queries to check order status, inquire about products, or ask for suggestions.
- **Ticket Routing Systems:** Automatically classify customer support emails or messages to route them to the correct department (e.g., shipping, billing, technical support).
- **Voice Assistants:** Act as the NLU component for voice-controlled shopping applications that target the Egyptian market.
### Out-of-Scope Use
This model is **not** designed for:
- General conversation or chit-chat.
- Sentiment analysis (detecting if a user is happy or angry).
- Translation or text generation.
- Understanding other Arabic dialects (e.g., Levantine, Gulf) with high accuracy.
## Bias, Risks, and Limitations
This model's knowledge is limited to the intents present in its custom training dataset. It may not recognize or may misclassify intents that are significantly different from the training data.
The primary risk is **misclassification**, which could lead to a poor user experience. It is highly recommended to implement a **confidence threshold** in any production application. If the model's top prediction score is below a certain value (e.g., 0.80), the system should ask for clarification or escalate the query to a human agent.
## Training Details
### Training Data
The model was fine-tuned on a private, custom-built dataset of Egyptian colloquial Arabic sentences. The data was manually curated, cleaned, and labeled to cover a range of common user intents in an e-commerce context. The dataset includes a set of distinct intents such as `order_status`, `shipping_info`, `product_alternatives`, `product_suggestions`, `company_info`, `cancel_order`, and others. The final training set size was approximately 80% of the total cleaned dataset, with the remaining 20% used for testing.
### Training Procedure
The model was trained using the `transformers` library's `Trainer` API. The process involved fine-tuning for 8 epochs with the best model being saved based on the F1-score on the evaluation set.
#### Training Hyperparameters
- **Base Model:** `UBC-NLP/MARBERTv2`
- **Learning Rate:** `2e-5`
- **Train Batch Size:** 16
- **Eval Batch Size:** 16
- **Number of Epochs:** 8
- **Optimizer:** AdamW
- **Warmup Ratio:** 0.1
- **Weight Decay:** 0.01
## Evaluation
The model was evaluated on a held-out test set (20% of the total data).
#### Metrics
The following weighted metrics were used to provide a balanced view of performance across all intents:
- **Accuracy:** The percentage of correctly classified intents.
- **F1-Score:** The harmonic mean of precision and recall.
- **Precision:** Of all the predictions for an intent, how many were correct.
- **Recall:** Of all the actual instances of an intent, how many did the model correctly identify.
### Results
The model achieved the following performance on the final evaluation set:
| Metric | Score |
|-----------|--------|
| Accuracy | 88.5% |
| F1-Score | 88.4% |
| Precision | 90.4% |
| Recall | 88.5% |
These results indicate a strong and well-balanced model that is reliable for its intended use cases.
## Citation
If you use this model in your work, please consider citing the original MARBERT paper:
```bibtex
@inproceedings{abdelali-etal-2021-marbert,
title = "{MARBERT}: A Deep Bidirectional {A}rabic Language Model",
author = "Abdelali, Ahmed and
Darwish, Kareem and
Sajjad, Hamdy and
Nakov, Preslav",
booktitle = "Proceedings of the 21st International Conference on Computational Linguistics and Intelligent Text Processing (CICLing 2020)",
month = mar,
year = "2021",
address = "La Rochelle, France",
publisher = "Springer",
} |