Edit model card

gemma-dolly-agriculture

This model is based on 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
Downloads last month
105
Unable to determine this model’s pipeline type. Check the docs .

Adapter for