Downloads · 30 days
0
Tanmay3004/llama_medical
llama_medical is a machine learning model from Tanmay3004. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is a fine-tuned version of the LLaMA 3.2 - 3B large language model, optimized for medical question-answering tasks. The fine-tuning was conducted using Low-Rank Adaptation (LoRA) on a Medical QA dataset.
Downloads · 30 days
0
Access
Public
Updated Mar 8, 2025
Repo size
26.4 MB
Likes
1
Public
Click a slice to open those files.
.json17.3 MB · 65%
From the Hugging Face model README
This model is a fine-tuned version of the LLaMA 3.2 - 3B large language model, optimized for medical question-answering tasks. The fine-tuning was conducted using Low-Rank Adaptation (LoRA) on a Medical QA dataset.
LoRA allows for efficient parameter tuning by introducing trainable low-rank matrices that adapt the model weights without modifying the pre-trained parameters extensively.
transformersfp16 for mixed precision trainingThe training logs (attached below) indicate:
To load and use the model:
import os
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
os.environ["HF_KEY"] = "enter key to access your hugging face account in order to import the model"
model_name = "Tanmay3004/llama_medical"
tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=os.getenv("HF_KEY"))
model = AutoModelForCausalLM.from_pretrained(model_name, use_auth_token=os.getenv("HF_KEY"))
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
template = "Question:\n{question}\n\nAnswer:\n{answer}"
prompt = template.format(
question="What are the treatments for Paget's Disease of Bone?",
answer=""
)
def generate_medical_response(prompt):
inputs = tokenizer(prompt, return_tensors="pt").to(device) # Move inputs to the same device
outputs = model.generate(**inputs, max_new_tokens=100)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generate_medical_response(prompt))