Text Generation
LiteRT
Safetensors
GGUF
Bengali
English
agriculture
bangladesh
crop-disease-detection
yolov8
gemma
lora
rag
faiss
bm25
bengali-nlp
computer-vision
conversational
Instructions to use Shaq2/KrishokChat-Advisory-System with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Shaq2/KrishokChat-Advisory-System with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Shaq2/KrishokChat-Advisory-System:F16 # Run inference directly in the terminal: llama cli -hf Shaq2/KrishokChat-Advisory-System:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Shaq2/KrishokChat-Advisory-System:F16 # Run inference directly in the terminal: llama cli -hf Shaq2/KrishokChat-Advisory-System:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Shaq2/KrishokChat-Advisory-System:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf Shaq2/KrishokChat-Advisory-System:F16
Use Docker
docker model run hf.co/Shaq2/KrishokChat-Advisory-System:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use Shaq2/KrishokChat-Advisory-System with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Shaq2/KrishokChat-Advisory-System" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Shaq2/KrishokChat-Advisory-System", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Shaq2/KrishokChat-Advisory-System:F16
- Ollama
How to use Shaq2/KrishokChat-Advisory-System with Ollama:
ollama run hf.co/Shaq2/KrishokChat-Advisory-System:F16
- Unsloth Desktop
- Pi
How to use Shaq2/KrishokChat-Advisory-System with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Shaq2/KrishokChat-Advisory-System:F16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Shaq2/KrishokChat-Advisory-System:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Shaq2/KrishokChat-Advisory-System with Docker Model Runner:
docker model run hf.co/Shaq2/KrishokChat-Advisory-System:F16
- Lemonade
How to use Shaq2/KrishokChat-Advisory-System with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Shaq2/KrishokChat-Advisory-System:F16
Run and chat with the model
lemonade run user.KrishokChat-Advisory-System-F16
List all available models
lemonade list
- Hermes Agent
How to use Shaq2/KrishokChat-Advisory-System with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Shaq2/KrishokChat-Advisory-System:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Shaq2/KrishokChat-Advisory-System:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Shaq2/KrishokChat-Advisory-System with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Shaq2/KrishokChat-Advisory-System:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Shaq2/KrishokChat-Advisory-System:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 11,254 Bytes
6935d81 6250100 6935d81 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | ---
language:
- bn
- en
license: mit
tags:
- agriculture
- bangladesh
- crop-disease-detection
- yolov8
- gemma
- lora
- rag
- faiss
- bm25
- bengali-nlp
- computer-vision
pipeline_tag: text-generation
---
# KrishokChat: Agricultural Advisory & Disease Detection Model Suite
**KrishokChat** is an end-to-end provenance-traceable multi-task Bengali agricultural advisory and crop disease diagnosis system designed for Bangladeshi farming ecosystems.
This repository contains the complete suite of models, fine-tuned weights, knowledge indexes, and advisory maps used by the KrishokChat application.
---
## π Repository Structure
```
RaiyanKhaan/KrishokChat-Advisory-System/
βββ README.md # Main Model Card & Usage Guide
βββ vision/ # Ultralytics YOLO Crop & Disease Vision Models
β βββ crop_classifier/
β β βββ model.pt # 9-Crop Root Classifier (11.96 MB)
β β βββ class_names.json # Crop class mapping
β βββ brassica_disease/
β β βββ model.pt # Brassica Disease Classifier (10.54 MB)
β β βββ class_names.json # Disease labels (Alternaria, Black Rot, Downy Mildew, etc.)
β β βββ disease_details.json # Symptoms & remedy metadata
β βββ corn_disease/
β β βββ model.pt # Corn / Maize Disease Classifier (10.52 MB)
β β βββ class_names.json # Labels (Common Rust, Gray Leaf Spot, Northern Leaf Blight, Healthy)
β β βββ disease_details.json
β βββ potato_disease/
β β βββ model.pt # Potato Disease Classifier (10.52 MB)
β β βββ class_names.json # Labels (Early Blight, Late Blight, Healthy)
β β βββ disease_details.json
β βββ rice_disease/
β β βββ model.pt # Rice Disease Classifier (3.06 MB)
β β βββ class_names.json # Labels (Bacterial Blight, Brown Spot, Blast, Rice Hispa, Sheath Blight)
β β βββ disease_details.json
β βββ wheat_disease/
β β βββ model.pt # Wheat Disease Classifier (9.00 MB)
β β βββ class_names.json # Labels (Wheat Blast, Leaf Rust, Stem Rust, Stripe Rust, etc.)
β β βββ disease_details.json
β β βββ metadata.json
β βββ verification_report.json # Benchmark accuracies & test validation outputs
β βββ verification_report_live.md
βββ gemma_llm/ # Bengali Agricultural Domain Language Models
β βββ krishokchat.f16.gguf # 16-bit GGUF model for fast CPU/GPU inference via llama.cpp/Ollama (1.29 GB)
β βββ checkpoint-4020/ # Stage-1 SFT Fine-Tuned LoRA Adapter Weights & Tokenizer
β βββ adapter_model.safetensors # LoRA weights (266.2 MB)
β βββ adapter_config.json # LoRA hyperparameter configuration
β βββ tokenizer.json # Bengali-extended SentencePiece tokenizer (30.68 MB)
β βββ tokenizer_config.json
β βββ processor_config.json
β βββ chat_template.jinja # Jinja2 chat template for conversation turns
β βββ trainer_state.json # Training history & loss curves
β βββ training_args.bin
βββ rag_knowledge_index/ # Hybrid Dense (FAISS) + Sparse (BM25) Knowledge System
β βββ indexes/
β β βββ nodes.faiss # FAISS FlatIP index (BGE-M3 1024-dim dense embeddings) (8.34 MB)
β β βββ embeddings.npy # Dense embedding matrix
β β βββ bm25_index.pkl # Sparse BM25 Okapi retrieval index (16.23 MB)
β β βββ bm25_corpus_tok.pkl # Tokenized BM25 corpus (4.47 MB)
β β βββ node_ids.json # Node identifier lookup table
β β βββ term_map.json # Domain taxonomy, pesticide brand mapping & disease synonyms
β β βββ phase4_dialect_map.json # 6-Region Dialect normalization map (Barisal, Chittagong, Sylhet, etc.)
β βββ processed/
β β βββ knowledge_nodes_clean.jsonl # 2,135 Clean Knowledge Nodes (BARC, BARI, BRRI, CABI, DAE) (11.99 MB)
β β βββ knowledge_nodes_refined.jsonl # Refined multi-turn grounded knowledge nodes (9.95 MB)
β βββ eval/
β β βββ farmer_benchmark_1000.jsonl # 1,000 real-world Bengali farmer benchmark queries
β β βββ coverage_gaps_v1.json # Coverage gap audit report
β β βββ dialect_map_derivation_audit_v1.json
β βββ provenance/
β β βββ manifest_md_to_qa.json # Literature-to-QA audit trail (9.98 MB)
β β βββ manifest_node_to_qa.json # Node-to-QA audit trail (2.78 MB)
β βββ manifest.json # Build manifest with version hashes
β βββ README.md
βββ advisory_engine/ # Structured Advisory Mapping
βββ disease_knowledge_map.json # Disease-to-remedy & dosage structured dictionary
βββ generated_knowledge_nodes.jsonl # Multi-step expert verified advisory nodes
βββ generation_tasks.json # Advisory evaluation tasks
βββ test_cases.md # Clinical test cases & expected responses
```
---
## πΏ 1. Vision Models (Crop & Disease Detection)
The vision pipeline implements a two-stage hierarchical classifier using **Ultralytics YOLO**:
1. **Stage 1 (Root Crop Classifier)**: Identifies the crop species (`Brassica`, `Corn`, `Potato`, `Rice`, `Wheat`, `Solanacea`, etc.).
2. **Stage 2 (Disease Specialist)**: Routes the image to the dedicated crop disease classifier to determine the specific pathogen / health state.
### Classes Supported:
- **Rice Diseases**: Bacterial Leaf Blight, Brown Spot, Healthy Leaf, Leaf Blast, Leaf Scald, Narrow Brown Leaf Spot, Rice Hispa, Sheath Blight.
- **Wheat Diseases**: Wheat Blast, Black Point, Fusarium Foot Rot, Leaf Rust, Leaf Blight, Powdery Mildew, Stem Rust, Stripe Rust, Healthy.
- **Potato Diseases**: Early Blight, Late Blight, Healthy Leaf.
- **Corn Diseases**: Common Rust, Gray Leaf Spot, Northern Leaf Blight, Healthy.
- **Brassica Diseases**: Cabbage Alternaria Spot, Cabbage Black Rot, Cabbage Downy Mildew, Cauliflower Downy Mildew, Cauliflower Bacterial Soft Rot, Cauliflower Black Spot, Healthy.
### Usage Example:
```python
from ultralytics import YOLO
from PIL import Image
# 1. Classify Crop
crop_model = YOLO("vision/crop_classifier/model.pt")
crop_result = crop_model("leaf.jpg")[0]
predicted_crop = crop_model.names[crop_result.probs.top1]
print(f"Detected Crop: {predicted_crop}")
# 2. Classify Disease (e.g., Rice)
if predicted_crop.lower() == "rice":
disease_model = YOLO("vision/rice_disease/model.pt")
disease_result = disease_model("leaf.jpg")[0]
predicted_disease = disease_model.names[disease_result.probs.top1]
print(f"Diagnosis: {predicted_disease}")
```
---
## π€ 2. Language Models (Gemma Bengali Agriculture LLM)
- **Base Model**: Google Gemma 4B Instruction-Tuned
- **Fine-Tuning**: LoRA Stage 1 Supervised Fine-Tuning (SFT) on verified Bengali agricultural Q&A datasets.
- **GGUF Quantization**: 16-bit GGUF model optimized for CPU/GPU edge deployment.
### Usage with Hugging Face Transformers & PEFT:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model_id = "google/gemma-2-2b-it" # or 4B base
tokenizer = AutoTokenizer.from_pretrained("gemma_llm/checkpoint-4020")
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "gemma_llm/checkpoint-4020")
prompt = "<start_of_turn>user\nধানΰ§ΰ¦° বΰ§ΰ¦²ΰ¦Ύΰ¦Έΰ§ΰ¦ ΰ¦°ΰ§ΰ¦ΰ§ΰ¦° লΰ¦ΰ§ΰ¦·ΰ¦£ ΰ¦ ΰ¦ͺΰ§ΰ¦°ΰ¦€ΰ¦Ώΰ¦ΰ¦Ύΰ¦° ΰ¦ΰ§?<end_of_turn>\n<start_of_turn>model\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=300, temperature=0.2)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
### Usage with llama-cpp (GGUF):
```python
from llama_cpp import Llama
llm = Llama(
model_path="gemma_llm/krishokchat.f16.gguf",
n_ctx=2048,
n_threads=6
)
output = llm(
"<start_of_turn>user\nΰ¦ΰ¦²ΰ§ΰ¦° লΰ§ΰ¦ বΰ§ΰ¦²ΰ¦Ύΰ¦ΰ¦ ΰ¦ΰ§ΰ¦ΰ¦Ύΰ¦¬ΰ§ ΰ¦ͺΰ§ΰ¦°ΰ¦€ΰ¦Ώΰ¦°ΰ§ΰ¦§ ΰ¦ΰ¦°ΰ¦¬?<end_of_turn>\n<start_of_turn>model\n",
max_tokens=256,
temperature=0.2
)
print(output["choices"][0]["text"])
```
---
## π 3. Hybrid RAG Knowledge & Retrieval System
The RAG index combines dense semantic search and sparse lexical matching:
- **Dense Index**: FAISS FlatIP index with 1024-dimensional `BAAI/bge-m3` multilingual embeddings across 2,135 curated agricultural knowledge nodes.
- **Sparse Index**: BM25 Okapi index tokenized for Bengali domain vocabulary.
- **Dialect Normalization**: 6 Regional Bangladeshi dialects (Rajshahi, Sylhet, Chittagong, Barisal, Rangpur, Noakhali) mapped to standard terms.
- **Sources**: Bangladesh Agricultural Research Council (BARC FRG 2024), BARI, BRRI, CABI, DAE, DLS, DoF.
### Usage Example:
```python
import faiss
import numpy as np
import pickle
import json
# 1. Load FAISS index and metadata
index = faiss.read_index("rag_knowledge_index/indexes/nodes.faiss")
with open("rag_knowledge_index/indexes/node_ids.json", "r", encoding="utf-8") as f:
node_ids = json.load(f)
# 2. Load BM25 index
with open("rag_knowledge_index/indexes/bm25_index.pkl", "rb") as f:
bm25 = pickle.load(f)
print(f"FAISS index loaded with {index.ntotal} vectors.")
```
---
## π Integration with Frontend (`suggested-questions.tsx`)
In KrishokChat's user interface, `suggested-questions.tsx` connects directly to this model suite:
- Vision outputs (`predicted_crop`, `predicted_disease`) are mapped via `CROP_LABELS` and `DISEASE_LABELS` to dynamically generate targeted Bengali advisory prompts.
- `DialectSelector` triggers regional dialect queries normalized by `phase4_dialect_map.json` into the hybrid RAG retrieval pipeline.
---
## π License & Attribution
- **License**: MIT License
- **Developed by**: Raiyan Reza ([RaiyanKhaan](https://github.com/RaiyanKhaan)) and Shakil Ahmed ([MRSHAKILS](https://github.com/MRSHAKILS))
- **Project**: KrishokChat - A Provenance-Traceable Multi-Task Bengali Agricultural Advisory System
|