MedM-VL is a modular, LLaVA-based codebase for medical LVLMs.
Python
59
6 commits
updated Dec 23, 2025

MedM-VL is a modular, LLaVA-based codebase for medical LVLMs, supporting flexible customization of encoders, connectors, and LLMs.
MedM-VL focuses on small-scale medical LVLMs, designed for direct deployment in real-world medical scenarios or efficient fine-tuning on downstream tasks.
MedM-VL (v1.0: single image input, more details on Hugging Face)
# 1. clone and navigate
git clone https://github.com/MSIIP/MedM-VL.git
cd MedM-VL
# 2. create a conda environment, activate it and install packages
conda create -n medm python=3.10
conda activate medm
pip install -r requirements.txt
pip install flash-attn --no-build-isolation
If you are confused about some parameters during usage, please refer to Parameter Interpretation.
# For 2D medical LVLMs
# 1. pre-train (annotation format: examples/data/pretrain_2d.json)
bash examples/MedM-VL-2D/pretrain_en.sh
# 2. fine-tune (annotation format: examples/data/finetune_2d.json)
bash examples/MedM-VL-2D/finetune_en.sh
# For 3D medical LVLMs
# 1. pre-train (annotation format: examples/data/pretrain_3d.json)
bash examples/MedM-VL-CT-Chest/pretrain_en.sh
# 2. fine-tune (annotation format: examples/data/finetune_3d.json)
bash examples/MedM-VL-CT-Chest/finetune_en.sh
# In fact, there is no difference in the annotation file format between
# pre-training and fine-tuning. The former is from image-text pairs
# while the latter refers to instruction tuning data.
# For 2D medical LVLMs
# 1. download weights from Hugging Face
pip install -U huggingface_hub
huggingface-cli download --resume-download shiym2000/MedM-VL-2D-3B-en --local-dir work_dirs/MedM-VL-2D-3B-en
# 2. fine-tune using LoRA (annotation format: examples/data/finetune_2d.json)
bash examples/finetune_2d.sh
# For 3D medical LVLMs
# 1. download weights from Hugging Face
pip install -U huggingface_hub
huggingface-cli download --resume-download shiym2000/MedM-VL-CT-Chest-3B-en --local-dir work_dirs/MedM-VL-CT-Chest-3B-en
# 2. fine-tune using LoRA (annotation format: examples/data/finetune_3d.json)
bash examples/finetune_3d.sh
# You can choose full or LoRA fine-tuning based on available GPU memory.
# For 2D medical LVLMs
# inference (annotation format: examples/data/inference_2d.json)
bash examples/inference_2d.sh
# For 3D medical LVLMs
# inference (annotation format: examples/data/inference_3d.json)
bash examples/inference_3d.sh
# Compared to `finetune.json``, `conversations` in `inference.json` lacks
# the final response, which will be generated by the model.
# Launch a Gradio demo locally.
bash examples/playground.sh
| Encoder | Connector | LLM |
|
|
|
|
@inproceedings{shi2025medm,
title={Medm-vl: What makes a good medical lvlm?},
author={Shi, Yiming and Yang, Shaoshuai and Zhu, Xun and Wang, Haoyu and Fu, Xiangling and Li, Miao and Wu, Ji},
booktitle={International Workshop on Agentic AI for Medicine},
pages={290--299},
year={2025},
organization={Springer}
}
We would like to express our gratitude to the following resources:
5 commits
1 commits
Python
100.0%
MedM-VL is a modular, LLaVA-based codebase for medical LVLMs.
Python
59
6 commits
updated Dec 23, 2025

MedM-VL is a modular, LLaVA-based codebase for medical LVLMs, supporting flexible customization of encoders, connectors, and LLMs.
MedM-VL focuses on small-scale medical LVLMs, designed for direct deployment in real-world medical scenarios or efficient fine-tuning on downstream tasks.
MedM-VL (v1.0: single image input, more details on Hugging Face)
# 1. clone and navigate
git clone https://github.com/MSIIP/MedM-VL.git
cd MedM-VL
# 2. create a conda environment, activate it and install packages
conda create -n medm python=3.10
conda activate medm
pip install -r requirements.txt
pip install flash-attn --no-build-isolation
If you are confused about some parameters during usage, please refer to Parameter Interpretation.
# For 2D medical LVLMs
# 1. pre-train (annotation format: examples/data/pretrain_2d.json)
bash examples/MedM-VL-2D/pretrain_en.sh
# 2. fine-tune (annotation format: examples/data/finetune_2d.json)
bash examples/MedM-VL-2D/finetune_en.sh
# For 3D medical LVLMs
# 1. pre-train (annotation format: examples/data/pretrain_3d.json)
bash examples/MedM-VL-CT-Chest/pretrain_en.sh
# 2. fine-tune (annotation format: examples/data/finetune_3d.json)
bash examples/MedM-VL-CT-Chest/finetune_en.sh
# In fact, there is no difference in the annotation file format between
# pre-training and fine-tuning. The former is from image-text pairs
# while the latter refers to instruction tuning data.
# For 2D medical LVLMs
# 1. download weights from Hugging Face
pip install -U huggingface_hub
huggingface-cli download --resume-download shiym2000/MedM-VL-2D-3B-en --local-dir work_dirs/MedM-VL-2D-3B-en
# 2. fine-tune using LoRA (annotation format: examples/data/finetune_2d.json)
bash examples/finetune_2d.sh
# For 3D medical LVLMs
# 1. download weights from Hugging Face
pip install -U huggingface_hub
huggingface-cli download --resume-download shiym2000/MedM-VL-CT-Chest-3B-en --local-dir work_dirs/MedM-VL-CT-Chest-3B-en
# 2. fine-tune using LoRA (annotation format: examples/data/finetune_3d.json)
bash examples/finetune_3d.sh
# You can choose full or LoRA fine-tuning based on available GPU memory.
# For 2D medical LVLMs
# inference (annotation format: examples/data/inference_2d.json)
bash examples/inference_2d.sh
# For 3D medical LVLMs
# inference (annotation format: examples/data/inference_3d.json)
bash examples/inference_3d.sh
# Compared to `finetune.json``, `conversations` in `inference.json` lacks
# the final response, which will be generated by the model.
# Launch a Gradio demo locally.
bash examples/playground.sh
| Encoder | Connector | LLM |
|
|
|
|
@inproceedings{shi2025medm,
title={Medm-vl: What makes a good medical lvlm?},
author={Shi, Yiming and Yang, Shaoshuai and Zhu, Xun and Wang, Haoyu and Fu, Xiangling and Li, Miao and Wu, Ji},
booktitle={International Workshop on Agentic AI for Medicine},
pages={290--299},
year={2025},
organization={Springer}
}
We would like to express our gratitude to the following resources:
5 commits
1 commits
Python
100.0%