Cloudsurfer48902
commited on
Commit
•
a6b731b
1
Parent(s):
ba8f341
Update README.md
Browse files
README.md
CHANGED
@@ -12,23 +12,92 @@ tags:
|
|
12 |
- agriculture
|
13 |
- kenya
|
14 |
---
|
15 |
-
# Agronexus: Agricultural Recommendation Model for Kenya
|
16 |
|
17 |
-
|
18 |
|
19 |
## Model Details
|
20 |
-
- **Developed by:**
|
21 |
-
- **Base Model:** unsloth/llama-2-7b-bnb-4bit
|
22 |
- **Model Type:** Causal Language Model
|
23 |
-
- **Language:** English
|
24 |
-
- **
|
|
|
25 |
- **Finetuned with:** [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
## Training Data
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
## Input Format
|
34 |
The model expects input in the following format:
|
@@ -79,10 +148,11 @@ The model will return a JSON object with the following structure:
|
|
79 |
}
|
80 |
```
|
81 |
|
82 |
-
## Limitations
|
83 |
-
|
84 |
-
-
|
85 |
-
-
|
|
|
86 |
|
87 |
## Ethical Considerations
|
88 |
- Users should be aware that the model's recommendations are based on general patterns and may not be suitable for all specific local conditions.
|
@@ -99,7 +169,7 @@ model_name = "Cloudsurfer48902/agronexus"
|
|
99 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
100 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
101 |
|
102 |
-
prompt = "You are an expert agricultural advisor specializing in Kenyan agriculture. It is
|
103 |
|
104 |
inputs = tokenizer(prompt, return_tensors="pt")
|
105 |
outputs = model.generate(**inputs, max_length=1000, temperature=0.7)
|
@@ -107,4 +177,12 @@ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
107 |
print(response)
|
108 |
```
|
109 |
|
110 |
-
Note: Adjust the `max_length` and `temperature` parameters as needed for your specific use case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
- agriculture
|
13 |
- kenya
|
14 |
---
|
|
|
15 |
|
16 |
+
# Agronexus: Agricultural Recommendation Model for Kenya
|
17 |
|
18 |
## Model Details
|
19 |
+
- **Developed by:** William Obino
|
|
|
20 |
- **Model Type:** Causal Language Model
|
21 |
+
- **Language(s):** English
|
22 |
+
- **Base Model:** [unsloth/llama-2-7b-bnb-4bit](https://huggingface.co/unsloth/llama-2-7b-bnb-4bit)
|
23 |
+
- **License:** Apache 2.0
|
24 |
- **Finetuned with:** [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library
|
25 |
+
- **Model Size:** 7B parameters
|
26 |
+
- **Quantization:** Q4_K_M
|
27 |
+
- **Ollama Model:** [https://ollama.com/Cloudsurfer/agronexus](https://ollama.com/Cloudsurfer/agronexus)
|
28 |
+
- **Contacts:**
|
29 |
+
* LinkedIn: [https://www.linkedin.com/in/williamobino/](https://www.linkedin.com/in/williamobino/)
|
30 |
+
* X: [https://x.com/ObinoWilliam](https://x.com/ObinoWilliam)
|
31 |
+
* Instagram: [https://www.instagram.com/_cloudsurfer._/](https://www.instagram.com/_cloudsurfer._/)
|
32 |
+
* Github: [https://github.com/andomeder](https://github.com/andomeder)
|
33 |
+
|
34 |
+
## Model Description
|
35 |
+
|
36 |
+
Agronexus is a specialized AI model designed to provide agricultural recommendations for Kenya. It takes into account specific weather conditions, soil properties, and local agricultural knowledge to suggest suitable crops and farming practices.
|
37 |
+
|
38 |
+
## Intended Uses & Limitations
|
39 |
|
40 |
+
### Intended Uses
|
41 |
+
- Provide crop recommendations for specific locations in Kenya based on current weather and soil conditions.
|
42 |
+
- Offer detailed farming advice including planting dates, harvesting times, and care methods.
|
43 |
+
- Suggest cost-cutting measures and environmental considerations for Kenyan agriculture.
|
44 |
+
- Assist in crop rotation planning and pest management strategies.
|
45 |
+
|
46 |
+
### Limitations
|
47 |
+
- The model's knowledge is based on its training data and may not reflect very recent changes in agricultural practices or climate conditions in Kenya.
|
48 |
+
- Recommendations should be validated by local agricultural experts before implementation.
|
49 |
+
- The model may not account for all possible local variations in soil and microclimate conditions.
|
50 |
+
- The model is specifically tailored for Kenyan agriculture and may not be suitable for other regions.
|
51 |
|
52 |
## Training Data
|
53 |
+
|
54 |
+
* **Source:** Proprietary dataset containing 118 entries of detailed agricultural scenarios in Kenya. See a sample [here](https://huggingface.co/datasets/Cloudsurfer48902/Agronexus_dataset).
|
55 |
+
* **Content:** Historical weather data, soil composition data, successful crop yields, farming practices, and expert recommendations from Kenyan agricultural advisors.
|
56 |
+
* **Preprocessing:**
|
57 |
+
* Consistent formatting of weather and soil information.
|
58 |
+
* Standardization of location names.
|
59 |
+
* Categorization of climate types.
|
60 |
+
* Normalization of numerical values for weather and soil properties.
|
61 |
+
|
62 |
+
## Training Procedure
|
63 |
+
|
64 |
+
* **Library:** trl and unsloth were used for training.
|
65 |
+
* **Base Model:** meta-llama/Llama-2-7b-hf
|
66 |
+
* **Fine-tuned Model Name:** Agronexus-4bit
|
67 |
+
* **Training Hyperparameters:**
|
68 |
+
* Learning rate: 2e-4
|
69 |
+
* Batch size per device: 2
|
70 |
+
* Gradient accumulation steps: 4 (effective batch size of 8)
|
71 |
+
* Number of epochs: 25
|
72 |
+
* Optimizer: adamw_8bit
|
73 |
+
* Weight decay: 0.01
|
74 |
+
* Learning rate scheduler: linear
|
75 |
+
* Seed: 42
|
76 |
+
* Max sequence length: 2048
|
77 |
+
* Data type: torch.float16
|
78 |
+
* 4-bit quantization: True
|
79 |
+
* LoRA parameters:
|
80 |
+
* r: 16
|
81 |
+
* lora_alpha: 16
|
82 |
+
* lora_dropout: 0
|
83 |
+
* bias: "none"
|
84 |
+
* target_modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
|
85 |
+
* Gradient checkpointing: True
|
86 |
+
* Mixed precision training (FP16 or BF16): Automatically selected based on GPU support.
|
87 |
+
|
88 |
+
## Evaluation Results
|
89 |
+
* **Training Loss:** Decreased consistently over 25 epochs, reaching ~0.2946. This indicates successful learning and model improvement.
|
90 |
+
* **Further evaluation metrics:** Need to be calculated using a separate evaluation dataset to assess performance on unseen data. This could include accuracy, F1 score, and other metrics relevant for agricultural recommendation tasks.
|
91 |
+
|
92 |
+
## Environmental Impact
|
93 |
+
* **Hardware Type:** Tesla T4 GPU
|
94 |
+
* **Cloud Provider:** Google Colab.
|
95 |
+
* **Hours used:** Training took approximately 1 hour and 46 minutes (1.77 hours).
|
96 |
+
* **Carbon Emitted:** Not calculated. This depends on the cloud provider's energy sources and data center carbon intensity.
|
97 |
+
|
98 |
+
## Model Quantization
|
99 |
+
|
100 |
+
Quantized using the "q4_k_m" method for size reduction, resulting in a final model size of ~3.89 GB.
|
101 |
|
102 |
## Input Format
|
103 |
The model expects input in the following format:
|
|
|
148 |
}
|
149 |
```
|
150 |
|
151 |
+
## Bias, Risks, and Limitations
|
152 |
+
|
153 |
+
- The model's recommendations are based on historical data and may not account for recent climate changes or agricultural innovations
|
154 |
+
- There may be biases in the training data that could affect the diversity of crop recommendations
|
155 |
+
- The model does not consider socio-economic factors or individual farmer preferences in its recommendations
|
156 |
|
157 |
## Ethical Considerations
|
158 |
- Users should be aware that the model's recommendations are based on general patterns and may not be suitable for all specific local conditions.
|
|
|
169 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
170 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
171 |
|
172 |
+
prompt = "You are an expert agricultural advisor specializing in Kenyan agriculture. It is 30 August 2024. Given the following weather and soil conditions for Nairobi, Kenya, provide a recommendation for one (1) distinct crop suitable for growing. The location has a semi-arid climate. Weather: - Current Description: partly cloudy - Current Temperature: 22°C - Average Annual Temperature (5-year): 19°C - Average Annual Precipitation (5-year): 850 mm - 14-Day Forecast: - Average Max Temperature: 25°C - Average Min Temperature: 14°C - Total Precipitation: 20 mm Soil Properties: - clay: 35% - sand: 40% - silt: 25% - phh2o: 6.2 - cec: 18 cmol/kg Consider the specific Kenyan climate, local soil composition, and pH level when selecting the crop and providing advice. Ensure the recommendation is tailored to the given conditions. Output the recommendation in the following JSON format ONLY!"
|
173 |
|
174 |
inputs = tokenizer(prompt, return_tensors="pt")
|
175 |
outputs = model.generate(**inputs, max_length=1000, temperature=0.7)
|
|
|
177 |
print(response)
|
178 |
```
|
179 |
|
180 |
+
Note: Adjust the `max_length` and `temperature` parameters as needed for your specific use case.
|
181 |
+
|
182 |
+
## Model Card Authors
|
183 |
+
|
184 |
+
William Obino
|
185 |
+
|
186 |
+
## Model Card Contact
|
187 |
+
|
188 |
+
See "Model Details" section for contact information.
|