Logo Lanfrica

Hanasoummar/DarijaBert_Finetuning

Domain:

natural language processing

Record type:

modelsoftware
Creator:
Han
Host:
🧠 Moroccan Arabic (Darija) text classifier β€” DarijaBERT fine-tuned with LoRA for 10-class classification. Built with FastAPI backend and React frontend. # 🧠 DarijaBERT β€” Moroccan Arabic Text Classifier A production-ready NLP pipeline that fine-tunes **DarijaBERT** with **LoRA adapters** to classify Moroccan Arabic (Darija) text into 10 categories, served through a **FastAPI** backend and a polished **React** frontend. --- ## πŸ“‘ Table of Contents - ✨ Overview - πŸ“ Project Structure - πŸ—οΈ Architecture Overview - πŸ§ͺ Model Training - πŸ“Š Results & Evaluation - πŸš€ Live Demo - πŸ› οΈ Setup & Run - πŸ”Œ API Reference - πŸ” Environment Variables - πŸ“ˆ Possible Improvements - 🧰 Tech Stack - πŸ“„ License --- ## ✨ Overview | | | |---|---| | **Task** | 10-class text classification | | **Language** | Moroccan Arabic (Darija) | | **Base model** | `SI2M-Lab/DarijaBERT` | | **Fine-tuning** | LoRA (Low-Rank Adaptation) | | **F1 Score** | **0.82** | | **Avg. latency** | ~128ms | | **Hosted model** | `HanaSoummar/DarijaBERT-finetuned_model_with_LORA` | ### 🏷️ Categories | πŸ“° | 🍳 | πŸ›οΈ | 🎭 | 🩺 | ⚽ | πŸ’» | ✈️ | πŸ’° | πŸŽ“ | |---|---|---|---|---|---|---|---|---|---| | ActualitΓ©s | Cuisine | Culture | Divertissement | SantΓ© | Sport | Technologie | Voyage | Γ‰conomie | Γ‰ducation | --- ## πŸ“ Project Structure ``` DarijaBert-Project/ β”œβ”€β”€ notebooks/ β”‚ └── Finetuning.ipynb # LoRA fine-tuning notebook β”œβ”€β”€ data/ β”‚ └── dataset_darija2.csv β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ main.py # FastAPI server β”‚ β”œβ”€β”€ requirements.txt β”‚ └── .env.example β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ App.jsx β”‚ β”‚ β”œβ”€β”€ index.css β”‚ β”‚ └── main.jsx β”‚ β”œβ”€β”€ index.html β”‚ β”œβ”€β”€ package.json β”‚ β”œβ”€β”€ vite.config.js β”‚ └── .env.example β”œβ”€β”€ docs/ β”‚ └── screenshots/ β”œβ”€β”€ .gitignore └── README.md ``` --- ## πŸ—οΈ Architecture Overview | Layer | Stack | |---|---| | **Model** | DarijaBERT-base Β· LoRA adapters (`r=16`) Β· 10-class softmax head Β· πŸ€—Transformers | | **Training** | Mixed precision (fp16) Β· Gradient accumulation Β· Early stopping Β· Weighted cross-entropy | | **Backend** | FastAPI (async) Β· Torch JIT optimization Β· Batch inference Β· Healt …