Text Generation
Transformers
Safetensors
English
phi3
medical
healthcare
phi-3
fine-tuned
lora
conversational
custom_code
text-generation-inference
Instructions to use kaashh02/phi3-mini-medical-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kaashh02/phi3-mini-medical-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kaashh02/phi3-mini-medical-merged", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kaashh02/phi3-mini-medical-merged", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("kaashh02/phi3-mini-medical-merged", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kaashh02/phi3-mini-medical-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kaashh02/phi3-mini-medical-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaashh02/phi3-mini-medical-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kaashh02/phi3-mini-medical-merged
- SGLang
How to use kaashh02/phi3-mini-medical-merged with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kaashh02/phi3-mini-medical-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaashh02/phi3-mini-medical-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kaashh02/phi3-mini-medical-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaashh02/phi3-mini-medical-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kaashh02/phi3-mini-medical-merged with Docker Model Runner:
docker model run hf.co/kaashh02/phi3-mini-medical-merged
phi3-mini-medical-merged
This is a fine-tuned version of microsoft/Phi-3-mini-4k-instruct specialized for medical applications.
Model Details
- Base Model: microsoft/Phi-3-mini-4k-instruct
- Fine-tuning Method: LoRA (Low-Rank Adaptation)
- Specialization: Medical/Healthcare domain
- Precision: 8-bit quantization during training
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "kaashh02/phi3-mini-medical-merged"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# Example usage
prompt = "What are the symptoms of diabetes?"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Training Details
- Fine-tuned using LoRA adapters
- Optimized for medical question-answering and healthcare information
- Trained with 8-bit quantization for efficiency
Limitations
- This model is intended for educational and research purposes
- Should not be used as a substitute for professional medical advice
- Always consult healthcare professionals for medical decisions
Citation
If you use this model, please cite:
@misc{phi3_mini_medical_merged,
title={phi3-mini-medical-merged: Medical Fine-tuned Phi-3 Model},
author={Your Name},
year={2025},
howpublished={\url{https://huggingface.co/kaashh02/phi3-mini-medical-merged}}
}
- Downloads last month
- 21
Model tree for kaashh02/phi3-mini-medical-merged
Base model
microsoft/Phi-3-mini-4k-instruct