Model reference · open weights
Lingshu is an open-weight language model from lingshu-medical-mllm. Lingshu-7B (BF16) weighs 16.6 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the lingshu-medical-mllm/Lingshu-7B model card, 2026-10-01
What it is
| Released by | lingshu-medical-mllm |
|---|---|
| Released | 2025-06-05 |
| Parameters | 8.3B |
| VRAM | 16.6 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB … RTX 4060 Ti 16 GB 2 smaller cards | ||||
| RTX 3090 24 GB | 10 | 2 | 80K | 23.4 GB |
| RTX 4090 24 GB | 9 | 2 | 79K | 23.4 GB |
| RTX 5090 32 GB | 26 | 6 | all 125K | 31.0 GB |
| L40S 48 GB | 53 | 13 | all 125K | 44.0 GB |
| A100 80 GB | 126 | 31 | all 125K | 78.2 GB |
| H100 80 GB | 117 | 29 | all 125K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 150 | 37 | all 125K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 179 | 44 | all 125K | 107 GB |
| H200 141 GB | 244 | 61 | all 125K | 138 GB |
| B200 180 GB | 323 | 80 | all 125K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 5 | 1 | 42K | 11.6 GB a card |
| 2× RTX 4060 Ti 16 GB tensor parallel | 21 | 5 | all 125K | 15.4 GB a card |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 19.1 GB | 20.6 GB |
| 5 | 21.0 GB | 28.1 GB |
| 8 | 22.4 GB | 33.7 GB |
| 16 | 26.2 GB | 48.7 GB |
| 32 | 33.7 GB | 78.8 GB |
| 64 | 48.7 GB | 139 GB |
One card, with vLLM's small-card settings.
From the model card
This repository contains the model of the paper Lingshu: A Generalist Foundation Model for Unified Multimodal Medical Understanding and Reasoning. We also release a comprehensive medical evaluation toolkit in MedEvalKit, which supports fast evaluation of major multimodal and textual medical tasks.
Disclaimer: We must note that even though the weights, codes, and demos are released in an open manner, similar to other pre-trained language models, and despite our best efforts in red teaming and safety fine-tuning and enforcement, our models come with potential risks, including but not limited to inaccurate, misleading or potentially harmful generation. Developers and stakeholders should perform their own red teaming and provide related security measures before deployment, and they must abide by and comply with local governance and regulations. In no event shall the authors be held liable for any claim, damages, or other liability arising from the use of the released weights, codes, or demos.
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"lingshu-medical-mllm/Lingshu-7B",
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
device_map="auto",
)
processor = AutoProcessor.from_pretrained("lingshu-medical-mllm/Lingshu-7B")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "example.png",
},
{"type": "text", "text": "Describe this image."},
],
}
]
# Preparation for inference
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
)
inputs = inputs.to(model.device)
# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
from vllm import LLM, SamplingParams
from qwen_vl_utils import process_vision_info
import PIL
from transformers import AutoProcessor
processor = AutoProcessor.from_pretrained("lingshu-medical-mllm/Lingshu-7B")
llm = LLM(model="lingshu-medical-mllm/Lingshu-7B", limit_mm_per_prompt = {"image": 4}, tensor_parallel_size=2, enforce_eager=True, trust_remote_code=True,)
sampling_params = SamplingParams(
temperature=0.7,
top_p=1,
repetition_penalty=1,
max_tokens=1024,
stop_token_ids=[],
)
text = "What does the image show?"
image_path = "example.png"
image = PIL.Image.open(image_path)
message = [
{
"role":"user",
"content":[
{"type":"image","image":image},
{"type":"text","text":text}
]
}
]
prompt = processor.apply_chat_template(
message,
tokenize=False,
add_generation_prompt=True,
)
image_inputs, video_inputs = process_vision_info(message)
mm_data = {}
mm_data["image"] = image_inputs
processed_input = {
"prompt": prompt,
"multi_modal_data": mm_data,
}
outputs = llm.generate([processed_input], sampling_params=sampling_params)
print(outputs[0].outputs[0].text)
If you find our project useful, we hope you would kindly star our repo and cite our work as follows:
@article{xu2025lingshu,
title={Lingshu: A Generalist Foundation Model for Unified Multimodal Medical Understanding and Reasoning},
author={Xu, Weiwen and Chan, Hou Pong and Li, Long and Aljunied, Mahani and Yuan, Ruifeng and Wang, Jianyu and Xiao, Chenghao and Chen, Guizhen and Liu, Chaoqun and Li, Zhaodonghui and others},
journal={arXiv preprint arXiv:2506.07044},
year={2025}
}
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.