FreedomIntelligence/medical-o1-reasoning-SFT
Viewer • Updated • 90.1k • 15.1k • 1.17k
How to use Vamsikrishna2004/Medical-Reasoning-Llama-8B with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Vamsikrishna2004/Medical-Reasoning-Llama-8B to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Vamsikrishna2004/Medical-Reasoning-Llama-8B to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Vamsikrishna2004/Medical-Reasoning-Llama-8B to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="Vamsikrishna2004/Medical-Reasoning-Llama-8B",
max_seq_length=2048,
)This model is a fine-tuned version of LLaMA-8B, trained with Unsloth for efficiency.
It is designed to provide evidence-driven clinical reasoning and a concise final answer.
⚠️ Disclaimer: This model is for research & educational purposes only. Not for clinical use.
from unsloth import FastLanguageModel
import torch
model_name = "Vamsikrishna2004/Medical-Reasoning-Llama-8B"
max_seq_length = 2048
dtype = torch.float16
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=model_name,
max_seq_length=max_seq_length,
dtype=dtype,
load_in_4bit=load_in_4bit,
)
# Set the model to inference mode for text generation
FastLanguageModel.for_inference(model)
from transformers import TextStreamer
new_prompt = """You are an evidence-driven clinical assistant. Always include clear clinical reasoning and a concise final answer. If the case looks emergent, advise immediate in-person care.
### Question:
A 78 year old man with a history of smoking presents with a new, persistent cough and weight loss. A chest X-ray shows a mass in the right lung. What is the most likely diagnosis and what is the next step in management?
### Clinical Reasoning:
"""
inputs = tokenizer(
[new_prompt], return_tensors="pt"
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=512,
use_cache=True,
streamer=TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True),
)