Instructions to use MedMLX/medsam2-ct-lesion-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use MedMLX/medsam2-ct-lesion-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download MedMLX/medsam2-ct-lesion-mlx --local-dir medsam2-ct-lesion-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
MedSAM2 · CT Lesions
Initialize a CT lesion mask with a box prompt, then propagate it across slices with MedSAM2.
| Input | Output |
|---|---|
| CT + slice-level box prompt | Propagated lesion masks |
Apple Silicon · Metal · Python 3.13
Converted from the published MedSAM2 CT lesion checkpoint without retraining.
Quick start
uv venv --python 3.13
source .venv/bin/activate
uv pip install "medsam2-mlx>=0.2.8"
uv tool install huggingface-hub
hf download MedMLX/medsam2-ct-lesion-mlx --revision 22f5e6dc4850a71abf92ef1a8fea0db14c34d460 --local-dir models
Replace the example input paths with your own files.
from medsam2_mlx.medmlx import run
result = run(
image_path="ct.nii.gz",
weights_path="models/MedSAM2_CTLesion.safetensors",
output_dir="outputs",
box_xyxy=[411, 270, 442, 301],
frame_idx=68,
propagation="both",
slice_range=[60, 76],
)
print(result["outputs"])
Set the box and slice range for your volume. frame_idx uses the third voxel axis; box coordinates use the first two axes.
Use & license
For research and education. Not validated for clinical use.
The original MedSAM2 model card identifies the checkpoint license as CC-BY-SA-4.0 and separately states that the model weights can only be used for research and education. CC-BY-SA-4.0 permits commercial use; the source does not explain how these statements relate. Both are preserved here for users to review.
Credit the MedSAM2 authors and link the source and license when sharing; identify changes and preserve applicable share-alike terms. MedMLX converted the CT lesion checkpoint to MLX safetensors without retraining. See NOTICE, the license text, and upstream notices.
Paper references
Citation
If you use MedMLX, please cite the MedMLX paper:
@article{sandoval2026medmlx,
title = {MedMLX: On-Device Medical Imaging AI for Apple Silicon},
author = {Sandoval, A. and Sandoval, J. and Saleem, A.},
journal = {medRxiv},
year = {2026},
doi = {10.64898/2026.10.28.26366762}
}
Quantized
Model tree for MedMLX/medsam2-ct-lesion-mlx
Base model
wanglab/MedSAM2