Instructions to use OpenMed/OpenMed-Medical-27B-Preview-03 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMed/OpenMed-Medical-27B-Preview-03 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenMed/OpenMed-Medical-27B-Preview-03") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenMed/OpenMed-Medical-27B-Preview-03") model = AutoModelForMultimodalLM.from_pretrained("OpenMed/OpenMed-Medical-27B-Preview-03", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenMed/OpenMed-Medical-27B-Preview-03 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenMed/OpenMed-Medical-27B-Preview-03" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenMed/OpenMed-Medical-27B-Preview-03", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/OpenMed/OpenMed-Medical-27B-Preview-03
- SGLang
How to use OpenMed/OpenMed-Medical-27B-Preview-03 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 "OpenMed/OpenMed-Medical-27B-Preview-03" \ --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": "OpenMed/OpenMed-Medical-27B-Preview-03", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "OpenMed/OpenMed-Medical-27B-Preview-03" \ --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": "OpenMed/OpenMed-Medical-27B-Preview-03", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use OpenMed/OpenMed-Medical-27B-Preview-03 with Docker Model Runner:
docker model run hf.co/OpenMed/OpenMed-Medical-27B-Preview-03
OpenMed Medical 27B Preview 03
An experimental preview of OpenMed's medical fine-tune of Qwen3.8-27B. It thinks a medical question through before it answers, and it runs on your own hardware as one standalone checkpoint. We are releasing three preview checkpoints from the same line of work so that people can try them on real questions and tell us what works and what does not. Preview 03 is the most strongly tuned of the three.
| Developed by | OpenMed |
|---|---|
| Base model | Qwen3.8-27B by the Qwen team (Apache-2.0) |
| Status | Experimental preview, shared for feedback |
| The previews | Preview 01 ยท Preview 02 ยท Preview 03 (this one) |
| Size | 27B parameters, FP16 safetensors in 18 shards, about 55.6 GB |
| Input | English text. The base model's vision components are included but were not tested in this preview. |
| Output | A reasoning block, then the answer |
| License | Apache-2.0 |
About OpenMed
OpenMed builds open models and open-source tools for clinical and biomedical text that run on your own hardware.
- 2,300+ open models on Hugging Face for clinical NER, de-identification, clinical trials and more.
- The OpenMed Python SDK, Apache-2.0:
pip install openmedfor de-identification, clinical NER, and FHIR and HL7 tooling, all local. - New models every week: follow OpenMed on Hugging Face and @OpenMed_AI on X.
Quick start
pip install -U transformers accelerate torch torchvision pillow
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer, set_seed
model_id = "OpenMed/OpenMed-Medical-27B-Preview-03"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
model_id, dtype=torch.float16, device_map="auto"
).eval()
messages = [{"role": "user", "content": "A patient on lisinopril asks if they can take ibuprofen for a few days of knee pain. What should their clinician weigh?"}]
inputs = tokenizer.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
enable_thinking=True, return_dict=True, return_tensors="pt",
).to(model.device)
set_seed(38241)
with torch.inference_mode():
output_ids = model.generate(
**inputs, max_new_tokens=4096, do_sample=True, temperature=1.0, top_p=0.95, top_k=20,
eos_token_id=[248046, 248044], pad_token_id=248044,
)
completion = output_ids[0, inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(completion, skip_special_tokens=True))
These are the sampling settings we use, and the checkpoint's generation_config.json sets the same ones by default. Give it room to think: the answers in this card took 352 to 1,953 new tokens, so 4,096 is plenty here, and harder questions can use 8,192 or more.
One real answer
The answer this preview gave to the question above, in our run of this code. In this run it skipped the reasoning: it closed the empty reasoning block three times (</think>) and then answered. The text after the last </think> is the answer:
Taking ibuprofen while on lisinopril can increase the risk of kidney injury, especially in patients with underlying risk factors such as dehydration, heart failure, or a history of acute kidney injury (AKI). NSAIDs like ibuprofen inhibit prostaglandin synthesis, which reduces blood flow to the kidneys, while ACE inhibitors like lisinopril dilate the efferent arterioleโboth mechanisms can compound to decrease glomerular filtration rate (GFR). This combination, particularly when combined with a diuretic (the "triple whammy"), significantly elevates the risk of AKI.
For short-term use (e.g., a few days), the risk is lower but still present. Clinicians should weigh the severity of the patient's knee pain against potential renal and cardiovascular risks. If pain is mild to moderate, non-pharmacological strategies (such as rest, ice, compression, elevationโRICE) or topical NSAIDs (e.g., diclofenac gel) may be safer alternatives, as they have minimal systemic absorption.
If oral ibuprofen is necessary, the lowest effective dose (e.g., 200โ400 mg as needed) should be used for the shortest duration possible (ideally โค3 days), with adequate hydration and avoidance of other nephrotoxic agents. Patients should be advised to watch for signs of kidney dysfunction (e.g., decreased urine output, swelling, fatigue) and seek prompt medical attention if symptoms occur.
In summary: short-term, low-dose ibuprofen may be acceptable with caution, but safer alternatives should be considered first, and patient-specific risk factors must be evaluated before use.
The three previews
- Preview 01 stays closest to Qwen3.8-27B.
- Preview 02 is tuned further. Start here.
- Preview 03 is the most strongly tuned.
Try the same question on two of them and tell us which answer you would rather give a colleague.
Tell us what you find
Open a discussion in the Community tab of this page with the question, the answer and what was right or wrong about it. Good answers, wrong answers and strange answers all help shape the next version.
Before you use it
- A preview. Shared for hands-on testing and feedback, not for leaderboard comparisons.
- Research and prototyping only. Answers can be wrong, incomplete or out of date, and long answers can run out of tokens. Do not use it for diagnosis, treatment or any decision about a patient.
- English text. Other languages and image input were not tested.
- Reading the output. The answer is the text after the last
</think>. In our runs this preview once skipped its reasoning and repeated the closing tag.
Built on
OpenMed fine-tuned this model from Qwen3.8-27B by the Qwen team (Apache-2.0). Thank you to the Qwen team for releasing it openly. See LICENSE and NOTICE.
OpenMed ยท Hugging Face ยท GitHub ยท PyPI ยท X
- Downloads last month
- 41