Logo Lanfrica

Souadzriouil/darijabert-lora-finetuning

Domain:

natural language processing

Record type:

project
Creator:
Sou
Host:
This project focuses on fine-tuning DarijaBERT for Moroccan Darija text classification using LoRA (Low-Rank Adaptation). The workflow includes data preprocessing, tokenization, model training, evaluation, and performance analysis using Hugging Face Transformers and PyTorch. # πŸš€ Fine-Tuning DarijaBERT for Moroccan Darija Text Classification ### 🧠 Parameter-Efficient NLP Fine-Tuning using LoRA & Hugging Face Transformers --- # πŸ“Œ Overview This project focuses on fine-tuning the **SI2M-Lab/DarijaBERT** model for **Moroccan Darija text classification** using **LoRA (Low-Rank Adaptation)**. The workflow demonstrates a complete modern NLP pipeline including: βœ… Data preprocessing βœ… Tokenization βœ… LoRA fine-tuning βœ… Model evaluation βœ… Metrics visualization βœ… Confusion matrix analysis The objective is to build an efficient NLP model capable of understanding and classifying Moroccan Darija text. --- # 🧰 Tech Stack | Category | Technologies | |---|---| | Programming | Python | | Deep Learning | PyTorch | | NLP | Hugging Face Transformers | | Fine-Tuning | LoRA / PEFT | | Data Processing | Pandas, NumPy | | Evaluation | Scikit-learn | | Visualization | Matplotlib | | Environment | Jupyter Notebook | --- # πŸ“‚ Project Structure ```bash darijabert-lora-finetuning/ β”‚ β”œβ”€β”€ data/ β”‚ └── dataset_darija2.csv β”‚ β”œβ”€β”€ notebooks/ β”‚ └── darijabert_finetuning.ipynb β”‚ β”œβ”€β”€ results/ β”‚ β”œβ”€β”€ confusion_matrix.png β”‚ └── training_metrics.png β”‚ β”œβ”€β”€ README.md β”œβ”€β”€ requirements.txt └── .gitignore ``` --- # βš™οΈ Workflow ```text Dataset β†’ Preprocessing β†’ Tokenization β†’ DarijaBERT β†’ LoRA Fine-Tuning β†’ Evaluation β†’ Visualization ``` --- # πŸ“Š Training Results | Metric | Score | |---|---| | 🎯 Accuracy | 79.67% | | 🧠 F1-Score | 78.91% | | πŸ“Œ Precision | 80.28% | | πŸ” Recall | 79.67% | --- # πŸ“ˆ Results Visualization ## πŸ”₯ Training Metrics --- ## 🧩 Confusion Matrix --- # πŸš€ Installation Clone the repository: ```bash git clone github.com cd darijabert-lora-finetuning ``` Install dependencies: ```bash pip install -r requirements.txt ``` --- # ▢️ Run the Project Launch Jupyter Notebook: ```bash jupyter notebook ``` Open: ```bash notebooks/darijabert_finetuning.ipynb ``` --- # …