Instructions to use me-nabi/farmer-advisory-hindi-qwen2.5-3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use me-nabi/farmer-advisory-hindi-qwen2.5-3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="me-nabi/farmer-advisory-hindi-qwen2.5-3b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("me-nabi/farmer-advisory-hindi-qwen2.5-3b", device_map="auto") - PEFT
How to use me-nabi/farmer-advisory-hindi-qwen2.5-3b with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use me-nabi/farmer-advisory-hindi-qwen2.5-3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "me-nabi/farmer-advisory-hindi-qwen2.5-3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "me-nabi/farmer-advisory-hindi-qwen2.5-3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/me-nabi/farmer-advisory-hindi-qwen2.5-3b
- SGLang
How to use me-nabi/farmer-advisory-hindi-qwen2.5-3b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "me-nabi/farmer-advisory-hindi-qwen2.5-3b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "me-nabi/farmer-advisory-hindi-qwen2.5-3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "me-nabi/farmer-advisory-hindi-qwen2.5-3b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "me-nabi/farmer-advisory-hindi-qwen2.5-3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use me-nabi/farmer-advisory-hindi-qwen2.5-3b with Docker Model Runner:
docker model run hf.co/me-nabi/farmer-advisory-hindi-qwen2.5-3b
🌾 HindiKrishi — Farmer Crop Advisory AI
Fine-tuned on 21K examples. Giving Indian farmers crop advice in Hindi.
Model Details
| Parameter | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-3B-Instruct |
| Method | QLoRA (4-bit quantization + LoRA r=16) |
| Training Data | 21,069 instruction-response pairs |
| Languages | Hindi (primary), English |
| Training Hardware | NVIDIA A100 80GB (RunPod) |
| Training Time | 83 minutes |
| Final Training Loss | 0.388 |
| Epochs | 2 |
| Trainable Parameters | 29.9M / 3.1B (0.96%) |
What This Model Does
- Answers crop disease identification questions in Hindi with specific chemical names
- Recommends pesticides with exact dosage (ml/liter, kg/hectare)
- Covers 25+ major Indian crops including wheat, rice, cotton, sugarcane, pulses, vegetables, and fruits
- Provides information on government agricultural schemes (PMFBY, PM-KISAN, PMKSY)
- Gives season-specific farming advice (Kharif, Rabi, Zayad)
- Every response includes a KVK consultation disclaimer for safety
Quick Start
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
# Load base model in 4-bit
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True,
)
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-3B-Instruct",
quantization_config=bnb_config,
device_map="auto",
)
# Load fine-tuned LoRA adapter
model = PeftModel.from_pretrained(base_model, "me-nabi/farmer-advisory-hindi-qwen2.5-3b")
tokenizer = AutoTokenizer.from_pretrained("me-nabi/farmer-advisory-hindi-qwen2.5-3b")
model.eval()
# Ask a question
SYSTEM = """आप भारतीय किसानों के लिए एक कृषि विशेषज्ञ सहायक हैं।
आप फसल रोग, कीट प्रबंधन, उर्वरक और खेती की सलाह देते हैं।
हमेशा व्यावहारिक सलाह दें और स्थानीय KVK से पुष्टि करने की सलाह दें।"""
question = "सरसों में माहू कीट के लिए कौन सा कीटनाशक छिड़कें?"
prompt = f"<|im_start|>system\n{SYSTEM}<|im_end|>\n<|im_start|>user\n{question}<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.7,
do_sample=True,
repetition_penalty=1.1,
)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Example Outputs
Hindi — Crop Disease Identification
Q: गेहूं में पीला रतुआ रोग के लक्षण क्या हैं?
A: गेहूं में पीला रतुआ रोग के लक्षण में पौधों की पत्तियाँ पीली हो जाती हैं। इसे नियंत्रित करने के लिए कापर ऑक्सीक्लोराइड (100 ग्राम प्रति 200 लीटर पानी) का छिड़काव करें। अधिक जानकारी के लिए अपने नजदीकी KVK से संपर्क करें।
Hindi — Pesticide Recommendation
Q: सरसों में माहू कीट के लिए कौन सा कीटनाशक छिड़कें?
A: सरसों में माहू कीट के लिए Imidacloprid का उपयोग करें। इसकी मात्रा 0.5-1 ग्राम प्रति लीटर पानी में मिलाकर छिड़कें। यह छिड़काव बुवाई के 20-30 दिन बाद करें। अधिक जानकारी के लिए अपने नजदीकी KVK से संपर्क करें।
Hindi — Sowing Schedule
Q: रबी सीजन में गेहूं की बुवाई कब करनी चाहिए?
A: रबी सीजन में गेहूं की बुवाई 15-20 अक्टूबर से 10-15 नवंबर के बीच करनी चाहिए। अधिक जानकारी के लिए अपने नजदीकी KVK से संपर्क करें।
English — Pest Control
Q: How to control aphids in mustard crop?
A: Aphid infestations can be controlled by spraying with insecticides like Malathion 50% EC or Quinalphos 25% EC at a rate of 1.0-1.5 liters per hectare.
English — Fertilizer Advice
Q: What fertilizer should I use for wheat?
A: A balanced fertilizer with nitrogen (N), phosphorus (P), and potassium (K) is ideal. The recommended NPK fertilizers are 60 kg/ha of urea (46% N), 20 kg/ha of superphosphate, and 15 kg/ha of muriate of potash. Additionally, apply 50 kg/ha of farmyard manure to enhance soil fertility.
Training Data
The model was trained on 21,069 instruction-response pairs from multiple sources:
| Source | Examples | Type |
|---|---|---|
| GPT-4o-mini generated from ICAR PDFs | 4,335 | Hindi crop disease Q&A with specific dosages |
| GPT-4o-mini targeted generation (crops × subtopics) | 4,726 | Hindi — 25 crops, diseases, pesticides, schemes |
| KisanVaani agriculture Q&A | 22,615 → deduplicated | English agriculture Q&A |
| Mahesh2841/Agriculture | 5,916 | English agriculture Q&A |
| DigiGreen + CGIAR | 2,274 | Hindi agriculture translations |
| Vikaspedia (scraped via Playwright) | 295 | Hindi government advisory content |
| Indic Anudesh (AI4Bharat) | 7,577 | Hindi instruction-following data |
All data was cleaned, deduplicated, and converted to Qwen ChatML format for training.
Training Configuration
LoRA Config:
r: 16
lora_alpha: 16
target_modules: [q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj]
dropout: 0
bias: none
Training Args:
per_device_train_batch_size: 32
gradient_accumulation_steps: 1
learning_rate: 2e-4
num_train_epochs: 2
optimizer: adamw_8bit
lr_scheduler: cosine
warmup_steps: 20
max_seq_length: 512
fp16: true
gradient_checkpointing: true
Training Loss Curve
Step 10: 1.495 Step 50: 0.645 Step 100: 0.555 Step 200: 0.477 Step 500: 0.434 Step 800: 0.408 Step 1000: 0.388 Step 1250: 0.348 Final: 0.388
Crops Covered
The model has been trained on data covering these Indian crops:
Cereals: Wheat (गेहूं), Rice (धान), Maize (मक्का), Bajra, Jowar
Pulses: Chickpea (चना), Pigeon pea (अरहर), Black gram (उड़द), Green gram (मूंग)
Oilseeds: Mustard (सरसों), Soybean (सोयाबीन), Groundnut (मूंगफली)
Cash Crops: Cotton (कपास), Sugarcane (गन्ना)
Vegetables: Tomato (टमाटर), Onion (प्याज), Chili (मिर्च), Brinjal (बैंगन), Okra (भिंडी), Potato (आलू), Cauliflower (गोभी), Spinach (पालक)
Fruits: Mango (आम), Banana (केला), Grapes (अंगूर), Orange (संतरा), Guava (अमरूद)
Spices: Turmeric (हल्दी), Ginger (अदरक), Garlic (लहसुन), Coriander (धनिया), Cumin (जीरा)
Limitations
- Hindi responses occasionally suggest incorrect chemical names for specific diseases — always verify with local KVK before application
- Government scheme details (amounts, percentages, dates) may not reflect the latest policy updates
- Model performs better on common crops (wheat, rice, cotton) than less common ones
- Responses are advisory only — not a substitute for professional agricultural consultation
- Dosage recommendations should be cross-checked with product labels and local KVK guidelines
- Not designed for emergency pest outbreak situations
Intended Use
Intended users:
- Agricultural extension workers providing advice to farmers
- Developers building mobile apps for offline crop advisory in rural India
- Researchers studying multilingual domain-specific LLM fine-tuning
- Students and educators demonstrating AI applications in agriculture
Not intended for:
- Direct pesticide application without KVK verification
- Medical or veterinary advice
- Legal or financial agricultural decisions
- Replacing trained agricultural scientists
Environmental Impact
- Hardware: NVIDIA A100 80GB
- Training Time: 83 minutes
- Cloud Provider: RunPod
- Estimated Carbon Emitted: ~0.15 kg CO2eq
Technical Architecture
Base Model: Qwen 2.5 3B Instruct (3,115,872,256 parameters) ↓ 4-bit NF4 Quantization (BitsAndBytes) ↓ LoRA Adapters (29,933,568 trainable parameters) ↓ Fine-tuned on 21,069 agricultural Q&A pairs ↓ ChatML format: system + user + assistant
Related Projects
- Aksara (CropIn AI): India-specific crop advisory model
- KisanVaani: Agricultural Q&A dataset
- AI4Bharat Indic Instruct: Hindi instruction-following data
Citation
@misc{hindikrishi2026,
title={HindiKrishi: A Fine-tuned Hindi Crop Advisory Model for Indian Farmers Using QLoRA},
author={Md Ehtasham Nabi},
year={2026},
publisher={HuggingFace},
url={https://huggingface.co/me-nabi/farmer-advisory-hindi-qwen2.5-3b}
}
Author
Md Ehtasham Nabi
- Founding AI/ML Engineer at Ksham (ksham.in)
Disclaimer
⚠️ This model is for informational purposes only. Agricultural advice varies significantly by region, soil type, climate, and season. Always confirm pesticide recommendations, dosages, and application methods with your local Krishi Vigyan Kendra (KVK) or qualified agricultural extension officer before application. Incorrect pesticide usage can damage crops, harm the environment, and pose health risks.