Downloads · 30 days
0
Keerthan097/LoRA-Prompt-Tradeoff-PubMedQA
LoRA-Prompt-Tradeoff-PubMedQA is a machine learning model from Keerthan097. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains LoRA adapters trained on the PubMedQA dataset to compare LoRA fine-tuning vs prompt engineering for biomedical question answering. Base model: meta-llama/Meta-Llama-3.1-8B
Downloads · 30 days
0
Access
Public
Updated Sep 22, 2025
Repo size
101 MB
Likes
0
Public
Click a slice to open those files.
.safetensors83.9 MB · 83%
From the Hugging Face model README
This repository contains LoRA adapters trained on the PubMedQA dataset to compare LoRA fine-tuning vs prompt engineering for biomedical question answering.
Base model: meta-llama/Meta-Llama-3.1-8B
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Meta-Llama-3.1-8B",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Keerthan097/LoRA-Prompt-Tradeoff-PubMedQA")
model = PeftModel.from_pretrained(base_model, "Keerthan097/LoRA-Prompt-Tradeoff-PubMedQA")
# Example inference
question = "Does aspirin reduce the risk of stroke?"
context = "A randomized controlled trial showed significant reduction..."
prompt = f"Question: {question}\nContext: {context}\nAnswer with one word: yes, no, maybe.\nAnswer:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=4)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))