qiaojin/PubMedQA
Viewer • Updated • 274k • 38.4k • 336
How to use iamaber/mistral-7b-pubmedqa-adapter with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="iamaber/mistral-7b-pubmedqa-adapter") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("iamaber/mistral-7b-pubmedqa-adapter", device_map="auto")How to use iamaber/mistral-7b-pubmedqa-adapter with PEFT:
Task type is invalid.
How to use iamaber/mistral-7b-pubmedqa-adapter with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "iamaber/mistral-7b-pubmedqa-adapter"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "iamaber/mistral-7b-pubmedqa-adapter",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/iamaber/mistral-7b-pubmedqa-adapter
How to use iamaber/mistral-7b-pubmedqa-adapter with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "iamaber/mistral-7b-pubmedqa-adapter" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "iamaber/mistral-7b-pubmedqa-adapter",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "iamaber/mistral-7b-pubmedqa-adapter" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "iamaber/mistral-7b-pubmedqa-adapter",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use iamaber/mistral-7b-pubmedqa-adapter with Docker Model Runner:
docker model run hf.co/iamaber/mistral-7b-pubmedqa-adapter
docker model run hf.co/iamaber/mistral-7b-pubmedqa-adapterThis adapter artifact fine-tunes mistralai/Mistral-7B-Instruct-v0.3 on qiaojin/PubMedQA / pqa_labeled using LoRA+.
| Field | Value |
|---|---|
| Train examples | 900 |
| Eval examples | 100 |
| Epochs | 3 |
| Train batch size | 4 |
| Eval batch size | 4 |
| Gradient accumulation | 4 |
| Learning rate | 5e-05 |
| Best eval loss | 0.5188 |
| Latest eval loss | 0.5188 |
| Latest train loss | 0.4810 |
| Train runtime (s) | 566.5676 |
| Global step | 171 |
| Metric | Value |
|---|---|
| PubMedQA accuracy | 0.4500 |
| PubMedQA macro F1 | 0.2069 |
| PubMedQA weighted F1 | 0.2793 |
| PubMedQA samples | 100 |
| Medical MMLU accuracy | 0.1600 |
| Medical MMLU samples | 50 |
| Subject | Accuracy | Correct | Total |
|---|---|---|---|
| anatomy | 0.1600 | 8 | 50 |
| clinical_knowledge | 0.0000 | 0 | 0 |
| college_medicine | 0.0000 | 0 | 0 |
| medical_genetics | 0.0000 | 0 | 0 |
| professional_medicine | 0.0000 | 0 | 0 |
| virology | 0.0000 | 0 | 0 |
| Actual \ Predicted | yes | no | maybe |
|---|---|---|---|
| yes | 45 | 0 | 0 |
| no | 40 | 0 | 0 |
| maybe | 15 | 0 | 0 |
Base model
mistralai/Mistral-7B-v0.3
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "iamaber/mistral-7b-pubmedqa-adapter"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iamaber/mistral-7b-pubmedqa-adapter", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'