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
|
Download README.md from MedMLX/lesiondiffusion-mlx: direct link, hf CLI and curl.
- Browser
- Download file 2.5 kB
-
https://huggingface.co/MedMLX/lesiondiffusion-mlx/resolve/main/README.md
- Command line
-
hf download hf://MedMLX/lesiondiffusion-mlx/README.md
-
curl -L -o README.md https://huggingface.co/MedMLX/lesiondiffusion-mlx/resolve/main/README.md
2.5 kB
| library_name: mlx | |
| inference: false | |
| license: mit | |
| tags: | |
| - mlx | |
| - medical-imaging | |
| - apple-silicon | |
| - research | |
| - inference | |
| - safetensors | |
| language: | |
| - en | |
| pipeline_tag: image-to-image | |
| <img src="https://huggingface.co/MedMLX/lesiondiffusion-mlx/resolve/main/banner.png" alt="MedMLX — Generate. CT / LESION SYNTHESIS" width="100%"> | |
| # LesionDiffusion | |
| Synthesize lesions in CT with native MLX using the released LMNet, LINet and VQ components. | |
| [GitHub](https://github.com/MedMLX/lesiondiffusion-mlx) · [Files](https://huggingface.co/MedMLX/lesiondiffusion-mlx/tree/main) · [Docs](https://github.com/MedMLX/lesiondiffusion-mlx/blob/main/README.md#run) · [Paper](https://doi.org/10.64898/2026.10.28.26366762) | |
| | Input | Output | | |
| | :--- | :--- | | |
| | CT + aligned binary organ mask | Synthetic CT and lesion mask | | |
| **Apple Silicon · Metal · Python 3.13** | |
| ## Quick start | |
| ```bash | |
| uv venv --python 3.13 | |
| source .venv/bin/activate | |
| uv pip install "lesiondiffusion-mlx>=0.2.6" | |
| uv tool install huggingface-hub | |
| hf download MedMLX/lesiondiffusion-mlx model.safetensors tokenizer.json conversion.json --revision d00bbb8ad1c7170062f60b4386a38c3a4178f7ce --local-dir models | |
| ``` | |
| Replace the example input paths with your own files. | |
| ```python | |
| from lesiondiffusion_mlx.medmlx import run | |
| result = run( | |
| image_path="ct_1mm_ras.nii.gz", | |
| organ_mask_path="liver_mask.nii.gz", | |
| weights_path="models", | |
| 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"]["synthetic_image"]) | |
| ``` | |
| 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](SOURCE_LICENSE), as published by the LesionDiffusion authors. [Notices](https://huggingface.co/MedMLX/lesiondiffusion-mlx/blob/main/NOTICE). | |
| ## Paper references | |
| - [Original model: LesionDiffusion: Towards Text-controlled General Lesion Synthesis](https://arxiv.org/abs/2503.00741). | |
| ## Citation | |
| If you use MedMLX, please cite the [MedMLX paper](https://doi.org/10.64898/2026.10.28.26366762): | |
| ```bibtex | |
| @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} | |
| } | |
| ``` | |