🩺 Medical Expert Model (LoRA Finetuned)

📌 Model Overview

This model is a LoRA fine-tuned version of unsloth/deepseek-r1-distill-llama-8b-unsloth-bnb-4bit.
It has been fine-tuned to act as a medical expert assistant — capable of providing simplified explanations of medical conditions, symptoms, and treatments in an accessible way.

The base model is an efficient 8B LLaMA variant, optimized with Unsloth for 2x faster training using Hugging Face’s TRL library.
This version uses bnb-4bit quantization, making it memory efficient and suitable for single-GPU setups such as Tesla T4 (16GB) or consumer GPUs.


⚡ Key Features

  • 🔬 Fine-tuned for medical explanations and advice
  • ⚡ Efficient: 4-bit quantized, runs on a single GPU or even CPU (slower)
  • 🚀 Trained with Unsloth for speed and efficiency
  • 📚 Based on DeepSeek-R1-Distill-Llama-8B

📥 Installation

Make sure you have the latest versions of:

pip install unsloth transformers accelerate bitsandbytes

🖥️ Usage (Colab / Local GPU)

import torch
from unsloth import FastLanguageModel
from transformers import TextStreamer

# Load the fine-tuned model
model_name = "RobinMillford/medical-expert-model-lora"

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = model_name,
    max_seq_length = 2048,
    dtype = torch.float16,   # fp16 recommended for GPU
    load_in_4bit = True,     # load in 4-bit quantized mode
    device_map = "auto",     # automatically place layers on GPU/CPU
)

# Prepare for inference
FastLanguageModel.for_inference(model)

# Example: Generate response
streamer = TextStreamer(tokenizer)
inputs = tokenizer("Explain hypertension to a patient in simple terms:", return_tensors="pt").to("cuda")

outputs = model.generate(**inputs, streamer=streamer, max_new_tokens=200)

📊 Example Output Prompt:

Explain diabetes to a patient in simple words.

Response:

Diabetes is a condition where your body has trouble using sugar from food for energy. This happens because your body either doesn’t make enough insulin or cannot use it properly. Insulin is like a key that helps sugar get into your cells. Without it, sugar stays in your blood, which can make you feel tired, thirsty, or need to urinate more often.

⚠️ Disclaimer

This model is not a substitute for professional medical advice.

It is intended for educational and research purposes only. Always consult a qualified healthcare provider for medical concerns.


Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support