Logo Lanfrica

Diana-codes/rwanda-agri-chatbot

Domain:

agriculturenatural language processing

Record type:

model
Creator:
Dia
Host:
# Rwanda Agricultural Chatbot > A domain-specific conversational AI system for Rwanda agriculture, powered by FLAN-T5 and fine-tuned on synthetic Rwanda-specific and general agriculture Q&A datasets. Deployed via Gradio with multi-turn chat capabilities and out-of-domain guarding. ## ✨ Features - **🌾 Rwanda-Focused**: Fine-tuned on 800 synthetic Rwanda agricultural Q&A pairs covering crops, seasons, soils, and pests - **💬 Multi-turn Chat**: Contextual conversation support for follow-up questions - **🛡️ OOD Detection**: Identifies and safely handles queries outside agricultural scope with rule-based fallbacks - **⚡ CPU-Friendly**: Full training and inference support on CPU with option for GPU acceleration - **📊 Comprehensive Metrics**: BLEU, ROUGE, token-F1, and Perplexity evaluation - **🎯 Lightweight**: Clean, minimal UI with conversation logging disabled by default ## 🚀 Quick Start ### Prerequisites - Python 3.12 - pip ### Installation 1. Clone the repository ```bash git clone cd rwanda-agri-chatbot ``` 2. Create and activate virtual environment ```bash python3 -m venv .venv source .venv/bin/activate ``` 3. Install dependencies ```bash pip install --upgrade pip pip install -r requirements.txt ``` ## 📊 Data Preparation Generate synthetic training datasets (no external CSVs required): ```bash python3 -m src.data_prep \ --output_dir data/processed \ --generate_rwanda 800 \ --generate_general 4000 \ --max_input_length 256 \ --max_target_length 128 \ --upsample_limit 10 ``` This creates: - **800** Rwanda-specific Q&A pairs - **4000** general agriculture Q&A pairs - Normalized and tokenized datasets ready for training ## 🏋️ Training ### Baseline (CPU-Friendly) Train the FLAN-T5 base model with recommended hyperparameters: ```bash CUDA_VISIBLE_DEVICES="" python3 -m src.train \ --processed_dir data/processed \ --model_name google/flan-t5-base \ --output_dir models/run_balanced \ --batch_size 2 \ --epochs 2 \ --learning_rate 5e-5 \ --optimizer adamw \ --wa …