agriqa-assistant / README.md
nada013's picture
Upload README.md with huggingface_hub
0772a46 verified
---
language:
- en
tags:
- agriculture
- farming
- qa
- lora
- peft
- qwen
license: mit
datasets:
- shchoi83/agriQA
base_model: Qwen/Qwen1.5-1.8B-Chat
---
# 🌾 AgriQA Assistant
An intelligent agricultural expert assistant fine-tuned on the agriQA dataset using Qwen1.5-1.8B-Chat with PEFT + LoRA.
## πŸš€ Features
- **Clear, practical steps** you can apply directly in the field
- **Specific measurements and quantities** for accurate application
- **Safety precautions** when needed
- **Expert tips** for better results
- **Structured responses** with numbered steps
## πŸ”§ Technical Details
- **Base Model**: Qwen/Qwen1.5-1.8B-Chat
- **Fine-tuning Method**: PEFT + LoRA (Parameter Efficient Fine-tuning)
- **Dataset**: agriQA (agricultural Q&A pairs)
- **Training Data**: 50,000 samples with structured prompts
- **LoRA Rank**: 2
- **LoRA Alpha**: 4
## πŸ“± Usage
### Direct Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen1.5-1.8B-Chat", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen1.5-1.8B-Chat", trust_remote_code=True)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "nada013/agriqa-assistant")
```
### Chat Format
```python
messages = [
{"role": "system", "content": "You are AgriQA, an agricultural expert assistant..."},
{"role": "user", "content": "How to control aphid infestation in mustard crops?"}
]
# Generate response
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=512, temperature=0.3)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
```
## 🎯 Response Format
The model provides structured responses:
1. **Direct answer** to the question
2. **Numbered step-by-step solution**
3. **Specific details** (measurements, quantities, product names)
4. **Safety precautions** if needed
5. **Extra tip or follow-up advice**
## πŸ’‘ Example Questions
- "How to control aphid infestation in mustard crops?"
- "What fertilizer should I use for coconut plants?"
- "How to increase milk production in cows?"
- "What is the treatment for white diarrhoea in poultry?"
- "How to preserve potato tubers for 7-8 months?"
## πŸ”’ Safety Note
Always follow safety guidelines when applying agricultural practices. The assistant provides general advice - consult local agricultural experts for region-specific recommendations.
## πŸ“Š Training Details
- **Epochs**: 1
- **Learning Rate**: 5e-4
- **Batch Size**: 1 (with gradient accumulation)
- **Max Length**: 256 tokens
- **Optimizer**: AdamW with fused implementation
- **Hardware**: 8GB GPU with 4-bit quantization
## 🀝 Contributing
This model is trained on the agriQA dataset. For improvements or questions, please refer to the original dataset source.
## πŸ“„ License
This project uses the Qwen1.5-1.8B-Chat model and agriQA dataset. Please refer to their respective licenses for usage terms.
---
**Built with ❀️ for the agricultural community**