Metadata-Version: 2.5
Name: mlx-generate
Version: 0.4.1
Summary: Native MLX implementation of NV-Generate (MAISI)
Author: Joseph Sandoval, Alfredo Sandoval Jr.
License-Expression: Apache-2.0
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Classifier: Operating System :: MacOS :: MacOS X
Requires-Python: <3.15,>=3.13
Requires-Dist: medmlx-core==0.2.4
Requires-Dist: mlx==0.32.4
Requires-Dist: nibabel<6,>=5.3
Requires-Dist: numpy<3,>=2.0
Requires-Dist: safetensors<1,>=0.6
Requires-Dist: scipy<2,>=1.15
Provides-Extra: conversion
Requires-Dist: monai==1.6.1rc0; extra == 'conversion'
Requires-Dist: torch<3,>=2.6; extra == 'conversion'
Description-Content-Type: text/markdown

# mlx-generate

Generate synthetic 3D CT and MRI on Apple Silicon with NVIDIA NV-Generate and native MLX.

[Docs](https://github.com/MedMLX/mlx-generate/blob/main/docs/technical.md) · [MedMLX](https://github.com/MedMLX)

![mlx-generate example output](https://raw.githubusercontent.com/MedMLX/mlx-generate/main/docs/example.png)

*A synthetic T1 brain MR from the MR-Brain configuration; no patient data.*

| Input | Output |
| :--- | :--- |
| Noise, or a CT anatomy mask | Synthetic 3D CT or MRI |

**Apple Silicon · Metal · Python 3.13 / 3.14** · [uv](https://docs.astral.sh/uv/)

## Quick start

```bash
uv venv --python 3.13
source .venv/bin/activate
uv pip install \
  "mlx-generate[conversion]" \
  huggingface-hub
```

Download and convert the checkpoint once, then run:

```python
from pathlib import Path

from huggingface_hub import hf_hub_download
from mlx_generate.convert import convert_from_files
from mlx_generate.medmlx import run

convert_from_files(
    vae_path=Path(hf_hub_download(
        "nvidia/NV-Generate-CT", "models/autoencoder_v1.pt",
        revision="48a68e95c77a095870e3374f5b2cca1dd211f317",
    )),
    unet_path=Path(hf_hub_download(
        "nvidia/NV-Generate-MR-Brain", "models/diff_unet_3d_rflow-mr-brain_v1.pt",
        revision="ef9759bf221265b2704569cdeeac20bbf03b62ee",
    )),
    output_dir=Path("mr-brain-weights"),
    configuration="mr-brain",
)

result = run(
    configuration="mr-brain",
    modality="mri_t1",
    weights_path="mr-brain-weights",
    output_dir="out",
    seed=0,
)
print(result["outputs"])
```

MR needs no patient image. Synthetic output is not ground truth. See Docs for CT and additional MR configurations.

## License

[Apache-2.0](https://github.com/MedMLX/mlx-generate/blob/main/LICENSE). See [third-party notices](https://github.com/MedMLX/mlx-generate/blob/main/THIRD_PARTY_NOTICES.md). Model weights retain their publisher terms. General-MR weights have noncommercial terms; CT component terms require publisher clarification.

For research and education. Outputs require human review.
