nada013 commited on
Commit
0772a46
Β·
verified Β·
1 Parent(s): 630f1d6

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - agriculture
6
+ - farming
7
+ - qa
8
+ - lora
9
+ - peft
10
+ - qwen
11
+ license: mit
12
+ datasets:
13
+ - shchoi83/agriQA
14
+ base_model: Qwen/Qwen1.5-1.8B-Chat
15
+ ---
16
+
17
+ # 🌾 AgriQA Assistant
18
+
19
+ An intelligent agricultural expert assistant fine-tuned on the agriQA dataset using Qwen1.5-1.8B-Chat with PEFT + LoRA.
20
+
21
+ ## πŸš€ Features
22
+
23
+ - **Clear, practical steps** you can apply directly in the field
24
+ - **Specific measurements and quantities** for accurate application
25
+ - **Safety precautions** when needed
26
+ - **Expert tips** for better results
27
+ - **Structured responses** with numbered steps
28
+
29
+ ## πŸ”§ Technical Details
30
+
31
+ - **Base Model**: Qwen/Qwen1.5-1.8B-Chat
32
+ - **Fine-tuning Method**: PEFT + LoRA (Parameter Efficient Fine-tuning)
33
+ - **Dataset**: agriQA (agricultural Q&A pairs)
34
+ - **Training Data**: 50,000 samples with structured prompts
35
+ - **LoRA Rank**: 2
36
+ - **LoRA Alpha**: 4
37
+
38
+ ## πŸ“± Usage
39
+
40
+ ### Direct Usage
41
+ ```python
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+ from peft import PeftModel
44
+
45
+ # Load base model
46
+ base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen1.5-1.8B-Chat", trust_remote_code=True)
47
+ tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen1.5-1.8B-Chat", trust_remote_code=True)
48
+
49
+ # Load LoRA adapter
50
+ model = PeftModel.from_pretrained(base_model, "nada013/agriqa-assistant")
51
+ ```
52
+
53
+ ### Chat Format
54
+ ```python
55
+ messages = [
56
+ {"role": "system", "content": "You are AgriQA, an agricultural expert assistant..."},
57
+ {"role": "user", "content": "How to control aphid infestation in mustard crops?"}
58
+ ]
59
+
60
+ # Generate response
61
+ inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")
62
+ outputs = model.generate(inputs, max_new_tokens=512, temperature=0.3)
63
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
64
+ ```
65
+
66
+ ## 🎯 Response Format
67
+
68
+ The model provides structured responses:
69
+ 1. **Direct answer** to the question
70
+ 2. **Numbered step-by-step solution**
71
+ 3. **Specific details** (measurements, quantities, product names)
72
+ 4. **Safety precautions** if needed
73
+ 5. **Extra tip or follow-up advice**
74
+
75
+ ## πŸ’‘ Example Questions
76
+
77
+ - "How to control aphid infestation in mustard crops?"
78
+ - "What fertilizer should I use for coconut plants?"
79
+ - "How to increase milk production in cows?"
80
+ - "What is the treatment for white diarrhoea in poultry?"
81
+ - "How to preserve potato tubers for 7-8 months?"
82
+
83
+ ## πŸ”’ Safety Note
84
+
85
+ Always follow safety guidelines when applying agricultural practices. The assistant provides general advice - consult local agricultural experts for region-specific recommendations.
86
+
87
+ ## πŸ“Š Training Details
88
+
89
+ - **Epochs**: 1
90
+ - **Learning Rate**: 5e-4
91
+ - **Batch Size**: 1 (with gradient accumulation)
92
+ - **Max Length**: 256 tokens
93
+ - **Optimizer**: AdamW with fused implementation
94
+ - **Hardware**: 8GB GPU with 4-bit quantization
95
+
96
+ ## 🀝 Contributing
97
+
98
+ This model is trained on the agriQA dataset. For improvements or questions, please refer to the original dataset source.
99
+
100
+ ## πŸ“„ License
101
+
102
+ This project uses the Qwen1.5-1.8B-Chat model and agriQA dataset. Please refer to their respective licenses for usage terms.
103
+
104
+ ---
105
+
106
+ **Built with ❀️ for the agricultural community**