Text Classification
Transformers
PyTorch
Arabic
bert
sentiment-analysis
arabic
marbert
twitter
text-embeddings-inference
Instructions to use iMeshal/arabic-sentiment-classifier-marbert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iMeshal/arabic-sentiment-classifier-marbert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="iMeshal/arabic-sentiment-classifier-marbert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("iMeshal/arabic-sentiment-classifier-marbert") model = AutoModelForSequenceClassification.from_pretrained("iMeshal/arabic-sentiment-classifier-marbert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files123---license: apache-2.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111---language: arlicense: apache-2.0library_name: transformerstags:- sentiment-analysis- arabic- marbert- text-classificationdatasets:- mksaad/arabic-sentiment-twitter-corpusmetrics:- accuracy- f1- precision- recall---# MARBERT Model for Arabic Sentiment Analysis (Positive/Negative)This is a fine-tuned version of `UBC-NLP/MARBERTv2` for Arabic Sentiment Analysis.The model is trained to classify Arabic text (specifically tweets) into two categories: **Positive (`LABEL_1`)** or **Negative (`LABEL_0`)**.## 🚀 Live DemoYou can test the model live on the Hugging Face Space:**[https://huggingface.co/spaces/iMeshal/arabic-sentiment-app](https://huggingface.co/spaces/iMeshal/arabic-sentiment-app)**---## 📊 Model PerformanceThe model was trained on 80% of the training data and validated on 20%. The final evaluation was performed on a separate, unseen test set.**Final Test Set Results (Accuracy: 94.40%)**| Metric | Score || :--- | :---: || **Accuracy** | **94.40%** || F1 (Macro) | 94.40% || Precision (Macro) | 94.40% || Recall (Macro) | 94.40% || Loss | 0.1667 |The model achieved its best validation accuracy of **93.4%** at Epoch 2, and `load_best_model_at_end` was used.---## 💻 Intended Use (How to use)You can use this model directly with the `transformers` pipeline.```pythonfrom transformers import pipeline# Load the pipelinepipe = pipeline("sentiment-analysis",model="iMeshal/arabic-sentiment-classifier-marbert")# Test with new textstexts = ["هذا المنتج رائع جداً أنصح به","أسوأ خدمة عملاء على الإطلاق","الجو اليوم جميل"]results = pipe(texts)print(results)# Output:# [# {'label': 'LABEL_1', 'score': 0.99...}, # Positive# {'label': 'LABEL_0', 'score': 0.99...}, # Negative# {'label': 'LABEL_1', 'score': 0.98...} # Positive# ]```## 📚 Training DataThe model was trained on the **[Arabic Sentiment Twitter Corpus](https://www.kaggle.com/datasets/mksaad/arabic-sentiment-twitter-corpus)** dataset from Kaggle.* **Preprocessing:** Long/concatenated tweets (which appeared to be noise) were cleaned.* **Training Set:** ~24,163 samples.* **Validation Set:** ~6,041 samples.* **Test Set:** ~11,508 samples.* **Balance:** All datasets were perfectly balanced (approx. 50% Positive / 50% Negative).---## ⚙️ Training ProcedureThe model was trained using the `transformers.Trainer` class with the following key hyperparameters:* **Framework:** PyTorch* **Base Model:** `UBC-NLP/MARBERTv2`* **Epochs:** 3 (with Early Stopping)* **Early Stopping:** Patience set to 2 (training stopped at Epoch 3, but Epoch 2 was the best).* **Batch Size:** 16* **Learning Rate:** 2e-5* **Tokenizer:** `AutoTokenizer` (with `padding="max_length"`, `truncation=True`, `max_length=512`)---### 📞 Contact* **Name:** Meshal AL-Qushaym* **Email:** meshalqushim@outlook.com* **Kaggle:** [kaggle.com/meshalfalah](https://www.kaggle.com/meshalfalah)
README.md+111-3