theone049's picture
update README.md
11ba6a3 verified
|
raw
history blame
1.79 kB
metadata
library_name: transformers
tags:
  - agriculture
  - question-answering
  - LoRA
  - tinyllama
  - fine-tuned
  - causal-lm
license: apache-2.0

🌾 AgriQA-TinyLlama-LoRA (Adapter)

A LoRA fine-tuned TinyLlama model for answering agriculture-related questions in a conversational format. This adapter is fine-tuned on the AgriQA dataset using parameter-efficient fine-tuning (PEFT) and is suitable for low-resource inference scenarios.

🧠 Model Details

  • Base Model: TinyLlama/TinyLlama-1.1B-Chat
  • LoRA Adapter Size: ~2MB
  • Dataset: shchoi83/agriQA
  • Task: Question Answering (Instruction Tuning)
  • Language: English
  • Adapter Only: This repository only contains the LoRA adapter. You must load it on top of the base model.
  • Trained by: @theone049

🚀 Usage

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel, PeftConfig

# Load base model and tokenizer
base_model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat")
tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat")

# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "theone049/agriqa-tinyllama-lora-adapter")

# Inference
prompt = """### Instruction:
Answer the agricultural question.

### Input:
What is the control measure for aphid infestation in mustard crops?

### Response:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))