Instructions to use MedMLX/lesiondiffusion-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use MedMLX/lesiondiffusion-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download MedMLX/lesiondiffusion-mlx --local-dir lesiondiffusion-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
LesionDiffusion
Synthesize lesions in CT with native MLX using the released LMNet, LINet and VQ components.
LesionDiffusion is the work of Wenhui Lei and co-authors. The model, its training method and the weights are theirs: see the original repository, HengruiTianSJTU/LesionDiffusion, and the paper, arXiv:2503.00741. This repository only repackages their released weights (original checkpoint folder) for MLX on Apple Silicon. Please cite their paper and star their repository if LesionDiffusion is useful to you.
Original repository · Original paper · Original weights · GitHub · Files · Docs · MedMLX paper
| Input | Output |
|---|---|
| CT + aligned binary organ mask | Synthetic CT and lesion mask |
Apple Silicon · Metal · Python 3.13
Quick start
uv venv --python 3.13
source .venv/bin/activate
uv pip install "lesiondiffusion-mlx>=0.3.0"
Replace the example input paths with your own files.
from lesiondiffusion_mlx import run
result = run(
image_path="ct_1mm_ras.nii.gz",
organ_mask_path="liver_mask.nii.gz",
output_dir="out",
organ="liver",
lesion_type="tumor",
bbox_size_mm=[30, 30, 20],
placement="inside_parenchyma",
inference_mode="conditioned",
diffusion_steps=200,
seed=23,
)
print(result["outputs"]["image"])
Weights download from this repository on first use, at a pinned revision. To fetch them yourself, download that revision and pass the folder as weights_path="models":
uv tool install huggingface-hub
hf download MedMLX/lesiondiffusion-mlx --revision d00bbb8ad1c7170062f60b4386a38c3a4178f7ce model.safetensors tokenizer.json conversion.json --local-dir models
Use an aligned CT and binary organ mask on a RAS 1 mm grid. Synthetic output is not ground truth.
Use & license
For research and education. Not validated for clinical use.
Weights: MIT, as published by the LesionDiffusion authors. Notices.
Paper references
Citation
Please cite the original paper:
Lei, W. et al. (2025). LesionDiffusion: Towards Text-controlled General Lesion Synthesis. MICCAI 2025, 327-336. https://doi.org/10.1007/978-3-032-04971-1_31
If you use MedMLX, please cite the MedMLX paper:
@article{sandoval2026medmlx,
title = {MedMLX: On-Device Medical Imaging AI for Apple Silicon},
author = {Sandoval, J. and Sandoval, A. and Saleem, A.},
journal = {medRxiv},
year = {2026},
doi = {10.64898/2026.10.28.26366762}
}
Quantized