Logo Lanfrica

ali-harti/darija-sentiment-analysis

Domain:

natural language processing

Record type:

modelsoftware
Creator:
ali
Host:
# πŸ‡²πŸ‡¦ Darija Sentiment Analysis A powerful and lightweight Moroccan Darija (Moroccan Arabic dialect) Sentiment Analysis model, built using **PEFT/LoRA** on top of the `SI2M-Lab/DarijaBERT` foundation model. This project classifies text into three categories: - πŸ”΄ **Negative** (Ψ³Ω„Ψ¨ΩŠΨ©) - βšͺ **Neutral** (Ω…Ψ­Ψ§ΩŠΨ―Ψ©) - 🟒 **Positive** (Ψ₯يجابية) ## ✨ Features - **High Accuracy**: Fine-tuned on over 56,000 Moroccan Darija examples (including Jumia reviews and curated datasets). - **Efficient & Fast**: Utilizes Low-Rank Adaptation (LoRA), keeping the model footprint incredibly small (~6 MB adapter) while preserving the massive base model knowledge. - **Interactive UI**: Comes with a clean, easy-to-use Web Interface built with Gradio. - **Ready-to-use**: Fully configured for local inference on CPU or GPU. ## πŸš€ Quick Start ### Prerequisites Ensure you have Python 3.8+ installed, then install the required dependencies: ```bash pip install -r requirements.txt ``` ### Running the Web App Launch the Gradio interface directly from your terminal: ```bash python app.py ``` The app will open automatically in your browser at `127.0.0.1`. ## 🧠 Model Architecture - **Base Model**: `SI2M-Lab/DarijaBERT` - **Fine-Tuning Method**: PEFT / LoRA (Rank = 16, Alpha = 32) - **Target Modules**: `query`, `key`, `value`, `classifier`, `pooler` - **Dataset Size**: ~56,000 balanced sentences (Train: 44.8k, Val: 5.6k, Test: 5.6k) - **Performance**: ~81% Accuracy across 3 classes ## πŸ“‚ Project Structure ```text darija_sentiment_analysis/ β”œβ”€β”€ app.py # Main Gradio application script β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ model_v5_final/ # Saved LoRA adapter and tokenizer weights β”œβ”€β”€ notebooks/ # Jupyter notebooks for data processing and training └── README.md # Project documentation ``` ## πŸ› οΈ Usage Example You can use the model directly via code without the UI: ```python import torch from transfo …