Downloads · 30 days
8
2% of all-time downloads
Pk3112/medmcqa-lora-llama3-8b-instruct
medmcqa-lora-llama3-8b-instruct is a text generation model from Pk3112. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as other.
Adapter weights only for meta-llama/Meta-Llama-3-8B-Instruct, fine-tuned to answer medical multiple-choice questions (A/B/C/D). Subjects used for fine-tuning and evaluation: Biochemistry and Physiology. Educational us…
Downloads · 30 days
8
2% of all-time downloads
All-time downloads
425
Public
Repo size
336 MB
Likes
0
Public
Click a slice to open those files.
.safetensors336 MB · 100%
From the Hugging Face model README
Adapter weights only for meta-llama/Meta-Llama-3-8B-Instruct, fine-tuned to answer medical multiple-choice questions (A/B/C/D).
Subjects used for fine-tuning and evaluation: Biochemistry and Physiology.
Educational use only. Not medical advice.
Access note: Llama-3 base is a public gated model on HF.
Accept the base model license on its page and use a fine-grained token that allows public gated repos.
import os, re
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE = "meta-llama/Meta-Llama-3-8B-Instruct"
ADAPTER = "Pk3112/medmcqa-lora-llama3-8b-instruct"
hf_token = os.getenv("HUGGINGFACE_HUB_TOKEN") # required if not logged in
tok = AutoTokenizer.from_pretrained(BASE, use_fast=True, token=hf_token)
base = AutoModelForCausalLM.from_pretrained(BASE, device_map="auto", token=hf_token)
model = PeftModel.from_pretrained(base, ADAPTER, token=hf_token).eval()
prompt = (
"Question: Which vitamin is absorbed in the ileum?\n"
"A. Vitamin D\nB. Vitamin B12\nC. Iron\nD. Fat\n\n"
"Answer:"
)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=8, do_sample=False)
text = tok.decode(out[0], skip_special_tokens=True)
m = re.search(r"Answer:\s*([A-D])\b", text)
print(f"Answer: {m.group(1)}" if m else text.strip())
Tip: For rich explanations, increase max_new_tokens. For answer-only, keep it small and stop after the letter to reduce latency.
| Model | Internal val acc (%) | Original val acc (%) | TTFT (ms) | Gen time (ms) | In/Out tokens |
|---|---|---|---|---|---|
| Llama-3-8B (LoRA) | 83.83 | 65.20 | 567 | 14874 | 148 / 80 |
r=32, alpha=64, dropout=0.0; targets q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj768Answer: <A/B/C/D>)subject_name (Biochemistry, Physiology)adapter_model.safetensorsadapter_config.jsonmeta-llama/Meta-Llama-3-8B-Instruct (public gated on HF)openlifescienceai/medmcqa — follow dataset license