File size: 1,934 Bytes
3df1dab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: en
license: apache-2.0
tags:
- text2text-generation
- crop-recommendation
- agriculture
- lora
- mt5
---

# 🌱 mT5 Crop Recommendation (LoRA Fine-tuned)

This is a fine-tuned [mT5](https://huggingface.co/google/mt5-base) model using **LoRA adapters** for crop recommendation tasks.  
It takes weather and environmental inputs and suggests the most suitable crop(s) along with profitability insights.

## πŸ§‘β€πŸ« Model Details
- **Base Model**: `google/mt5-base`
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
- **Framework**: πŸ€— Transformers
- **Dataset**: Custom crop recommendation dataset (weather, soil, profitability annotations)
- **Languages**: English

## πŸ“Š Training
- **Epochs**: ~0.1–1 (early stop around loss 0.1)
- **Trainable Parameters**: ~344K (LoRA only)
- **Total Parameters**: ~300M
- **Hardware**: A100 GPU (Colab)

## πŸ”Ž Example Usage

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

model_name = "your-username/mt5-crop-lora"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

query = "Suggest best crop given: rainfall=200mm, temperature=25C, soil=loamy"

inputs = tokenizer(query, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

**Sample Output:**

```
Best crop: Gram.  
Top 3: Gram, Mustard, Wheat.  
Weather outlook: Cooler, dry weather with lower rainfall.  
Profitability: Moderate.
```

## βœ… Use Cases

* Agricultural planning
* Crop advisory chatbots
* Climate-aware farming assistance

## ⚠️ Limitations

* Limited dataset β†’ may not generalize globally
* Should not replace expert advice
* Cross-check with local agronomic data

## πŸ“œ License

Apache 2.0

## πŸ™Œ Acknowledgements

* [Google Research](https://huggingface.co/google) for mT5
* Hugging Face Transformers & PEFT