Logo Lanfrica

frhate/tiny-mamba-darija

Domain:

natural language processing

Record type:

modelsoftware
Creator:
frh
Host:
A from-scratch implementation of a Mamba State Space Model (SSM) trained to speak Algerian Darija the colloquial Arabic dialect of Algeria, written in both Arabic script and Franco-Arab (Latin + numbers). Built with pure PyTorch. No Transformers. No attention. Just selective state spaces. # Tiny Mamba for Algerian Darija πŸ‡©πŸ‡Ώ A from-scratch implementation of a **Mamba State Space Model (SSM)** trained to speak **Algerian Darija** β€” the colloquial Arabic dialect of Algeria, written in both Arabic script and Franco-Arab (Latin + numbers). Built with pure PyTorch. No Transformers. No attention. Just selective state spaces. > **"ΨͺΨΉΨ¬Ψ¨Ω†ΩŠ Ω‡Ψ°ΩŠΩƒ Ψ§Ω„Ω„Ω‚Ψ·Ψ© ΩƒΩŠ ΩƒΩ†Ψͺ ف Ψ§Ω„Ω…Ψ±ΩŠΩƒΨ§Ω† . و Ψ§Ω„Ω„Ω‡ غير ΩŠΨΉΨ·ΩŠΩƒ Ψ§Ω„Ψ΅Ψ­Ψ© Ψ¨Ψ§Ω„ΨͺΩˆΩΩŠΩ‚"** --- ## πŸš€ Features - **Pure PyTorch Mamba** β€” no `mamba-ssm` CUDA kernels required - **Custom BPE Tokenizer** trained on real Algerian social media text - **Mixed-script support** β€” handles Arabic script (`Ψ΄Ψ­Ψ§Ω„`) and Franco-Arab (`3andek`) - **RTX 3060 Ti optimized** β€” trains on 8GB VRAM - **Repetition penalty + top-k sampling** for clean generation - **Resume training** from checkpoints automatically --- ## πŸ“ Project Structure . β”œβ”€β”€ darija_preprocessed.txt # Cleaned training corpus (not in repo, too big) β”œβ”€β”€ darija_tokenizer/ # Trained BPE tokenizer β”‚ β”œβ”€β”€ tokenizer.json β”‚ β”œβ”€β”€ vocab.txt β”‚ └── special_tokens.txt β”œβ”€β”€ checkpoints/ # Saved model checkpoints (not in repo, too big) β”‚ └── final_model.pt β”œβ”€β”€ darja_processing.py # Step 1: Clean raw text β”œβ”€β”€ train_tokenizer.py # Step 2: Train BPE tokenizer β”œβ”€β”€ mamba_darija.py # Step 3: Train Mamba model (pure PyTorch) β”œβ”€β”€ infernce.py # Step 4: Generate text β”œβ”€β”€ requirements.txt └── README.md --- ## πŸ› οΈ Installation ```bash git clone github.com cd tiny-mamba-darija python -m venv venv source venv/bin/activate pip install -r requirements.txt ## πŸ“š Dataset Uses the Algerian-Darija dataset by Ayoub Kirouane. 23 MB of raw Algerian social media text Preprocessed to remove HTML, emojis, URLs, mentions, and duplicate characters πŸ‹οΈ# Training from Scratch Step 1: Download & Preprocess python darja_processing.py Downloads from HuggingFace and cleans the text. Output: darija_preprocess …