File size: 2,973 Bytes
44410ab aa3b046 ecd0b97 aa3b046 792331d aa3b046 44410ab aa3b046 792331d aa3b046 38f6c77 ecd0b97 aa3b046 991f437 f41c5b4 991f437 aa3b046 1bd6fb5 aa3b046 1bd6fb5 aa3b046 6c31eff 4081aee ecd0b97 aa3b046 |
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
---
license: gemma
library_name: peft
tags:
- trl
- sft
- generated_from_trainer
base_model: google/gemma-2b
datasets:
- generator
model-index:
- name: gemma-dolly-agriculture
results: []
---
# gemma-dolly-agriculture
This model is based on [google/gemma-2b](https://huggingface.co/google/gemma-2b), fine tuned with the dolly-qa dataset and some specific examples of agricultural disease descriptions.
It achieves the following results on the evaluation set:
- Loss: 2.0198
## How to Run Inference
```
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model_id = "google/gemma-2b"
peft_model_id = "apfurman/gemma-dolly-agriculture"
# make sure you have access to gemma-2b as well
model = AutoModelForCausalLM.from_pretrained(model_id, token="YOUR_TOKEN_HERE")
model.load_adapter(peft_model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id, token="YOUR_TOKEN_HERE")
def ask(prompt):
inputs = tokenizer(prompt, return_tensors="pt").input_ids
with torch.inference_mode():
tokens = model.generate(
inputs,
pad_token_id=128001,
eos_token_id=128001,
max_new_tokens=200,
repetition_penalty=1.5,
)
return tokenizer.decode(tokens[0], skip_special_tokens=True)
```
## Intended uses & limitations
Created for prompting an AI about agricultural info, but more fine-tuning is needed as current results are not great.
## Training and evaluation data
## Training procedure
Trained on Intel Data Center GPU Max Series with Intel Developer Cloud running a jupyter notebook.
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-05
- train_batch_size: 2
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 8
- total_train_batch_size: 16
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.05
- training_steps: 1480
### Training results
| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-------:|:----:|:---------------:|
| 2.918 | 1.6393 | 100 | 2.5702 |
| 2.4342 | 3.2787 | 200 | 2.2747 |
| 2.2482 | 4.9180 | 300 | 2.1601 |
| 2.1554 | 6.5574 | 400 | 2.0971 |
| 2.1022 | 8.1967 | 500 | 2.0698 |
| 2.0806 | 9.8361 | 600 | 2.0544 |
| 2.0651 | 11.4754 | 700 | 2.0437 |
| 2.0439 | 13.1148 | 800 | 2.0359 |
| 2.0369 | 14.7541 | 900 | 2.0302 |
| 2.034 | 16.3934 | 1000 | 2.0263 |
| 2.0249 | 18.0328 | 1100 | 2.0236 |
| 2.0174 | 19.6721 | 1200 | 2.0218 |
| 2.0154 | 21.3115 | 1300 | 2.0203 |
| 2.0145 | 22.9508 | 1400 | 2.0198 |
### Framework versions
- PEFT 0.10.0
- Transformers 4.40.1
- Pytorch 2.1.0.post0+cxx11.abi
- Datasets 2.19.0
- Tokenizers 0.19.1 |