Downloads · 30 days
0
AshuReddy/medical-llama31-8b-sft-lora
medical-llama31-8b-sft-lora is a machine learning model from AshuReddy. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
LoRA-finetuned adapter for Llama-3.1 8B (4-bit) on the FreedomIntelligence/medical-o1-reasoning-SFT (en) dataset.
Downloads · 30 days
0
Access
Public
Updated Aug 29, 2025
Repo size
185 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 91%
From the Hugging Face model README
LoRA-finetuned adapter for Llama-3.1 8B (4-bit) on the FreedomIntelligence/medical-o1-reasoning-SFT (en) dataset.
unsloth/llama-3.1-8b-bnb-4bitYou are a careful medical assistant.
Read the question and provide the best final answer.
Question:
{question}
Answer:
r=16, lora_alpha=16, lora_dropout=0.05epochs=1, per_device_train_batch_size=2, gradient_accumulation_steps=8lr=2e-4, scheduler=cosine, warmup_ratio=0.1max_seq_length=2048, packing=True, fp16=Trueimport torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE = "unsloth/llama-3.1-8b-bnb-4bit"
ADAPTER = "AshuReddy/medical-llama31-8b-sft-lora"
tok = AutoTokenizer.from_pretrained(ADAPTER)
m = AutoModelForCausalLM.from_pretrained(
BASE,
device_map="auto",
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
)
m = PeftModel.from_pretrained(m, ADAPTER)
m.eval()
prompt = "You are a careful medical assistant.\n\nQuestion:\nWhat is PFO?\n\nAnswer:"
inputs = tok(prompt, return_tensors='pt').to(m.device)
with torch.no_grad():
out = m.generate(**inputs, max_new_tokens=256, do_sample=False, pad_token_id=tok.eos_token_id)
print(tok.decode(out[0], skip_special_tokens=True))
Simple exact/synonym/overlap metric; not a clinical benchmark.
FreedomIntelligence/medical-o1-reasoning-SFT