lavita/MedQuAD
Viewer • Updated • 47.4k • 5.33k • 23
How to use tsinviking/phi3-medical-lora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tsinviking/phi3-medical-lora")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("tsinviking/phi3-medical-lora", device_map="auto")How to use tsinviking/phi3-medical-lora with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tsinviking/phi3-medical-lora"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tsinviking/phi3-medical-lora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/tsinviking/phi3-medical-lora
How to use tsinviking/phi3-medical-lora with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tsinviking/phi3-medical-lora" \
--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": "tsinviking/phi3-medical-lora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "tsinviking/phi3-medical-lora" \
--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": "tsinviking/phi3-medical-lora",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use tsinviking/phi3-medical-lora with Docker Model Runner:
docker model run hf.co/tsinviking/phi3-medical-lora
| Component | Recommended |
|---|---|
| Base model | microsoft/phi-3-mini-4k-instruct |
| Fine-tuning method | LoRA (via peft + transformers) |
| Dataset | lavita/MedQuAD |
| Framework | Hugging Face PEFT + Transformers |
| Trainer | transformers.Trainer |
Reference
@ARTICLE{BenAbacha-BMC-2019, author = {Asma {Ben Abacha} and Dina Demner{-}Fushman}, title = {A Question-Entailment Approach to Question Answering}, journal = {{BMC} Bioinform.}, volume = {20}, number = {1}, pages = {511:1--511:23}, year = {2019}, url = {https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-019-3119-4} }
Base model
microsoft/Phi-3-mini-4k-instruct