Metadata-Version: 2.5
Name: nnunet-mlx
Version: 0.6.0
Summary: MLX-native nnU-Net v2 inference on Apple Silicon
Project-URL: Homepage, https://huggingface.co/MedMLX/nnunet-liver-mlx
Author: Joseph Sandoval
License-Expression: Apache-2.0 AND MIT
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Keywords: apple-silicon,image-segmentation,medical-imaging,mlx,nnunet
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: <3.15,>=3.13
Requires-Dist: blosc2<5,>=3.3.2
Requires-Dist: imagecodecs<2027,>=2025
Requires-Dist: medmlx-core==0.2.5
Requires-Dist: mlx==0.32.4; platform_system == 'Darwin' and platform_machine == 'arm64'
Requires-Dist: nibabel<6,>=5.3
Requires-Dist: numpy<3,>=2.0
Requires-Dist: pillow<14,>=13.0.0
Requires-Dist: safetensors<1,>=0.6
Requires-Dist: scikit-image==0.26.0
Requires-Dist: scipy==1.18.1
Requires-Dist: simpleitk==2.5.6
Requires-Dist: tifffile<2027,>=2025
Requires-Dist: typer==0.27.1
Provides-Extra: dev
Requires-Dist: hypothesis<7,>=6; extra == 'dev'
Requires-Dist: matplotlib<4,>=3.10; extra == 'dev'
Requires-Dist: pyright==1.1.414; extra == 'dev'
Requires-Dist: pytest<10,>=8.4; extra == 'dev'
Requires-Dist: ruff<1,>=0.13; extra == 'dev'
Provides-Extra: oracle
Requires-Dist: dynamic-network-architectures==0.4.4; extra == 'oracle'
Requires-Dist: nnunetv2==2.8.1; extra == 'oracle'
Requires-Dist: torch==2.13.0; extra == 'oracle'
Requires-Dist: urllib3<3,>=2.8; extra == 'oracle'
Description-Content-Type: text/markdown

# nnunet-mlx

Run pretrained nnU-Net v2 models locally on Apple Silicon with native MLX.

[Liver model weights](https://huggingface.co/MedMLX/nnunet-liver-mlx)

| Input | Output |
| :--- | :--- |
| NIfTI channels + model folder | Segmentation and optional probabilities |

**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 "nnunet-mlx>=0.6.0"
```

```python
from nnunet_mlx.medmlx import liver

result = liver(image_path="ct.nii.gz", output_dir="out")
print(result["outputs"]["segmentation"])
```

Omitted weights download automatically from `MedMLX/nnunet-liver-mlx` into
`~/.cache/medmlx/nnunet-liver`. Downloads resume after interruption;
completed downloads work offline. An explicit `weights_path` overrides this with
one local folder. Run details include `weights_revision` for managed downloads.
The automatic-weight interface is provided by `nnunet-mlx==0.6.0` with
`medmlx-core==0.2.5`. Model files use the canonical repository named above.

## Local weights and CLI

Download the published liver model, then predict:

```bash
python - <<'PY'
from huggingface_hub import snapshot_download

snapshot_download(
    "MedMLX/nnunet-liver-mlx",
    revision="574a9c601b9b1a9e906ce985fbd46b106c5b7caa",
    local_dir="mlx-model",
)
PY
```

```bash
nnunet-mlx model predict \
  --model-folder mlx-model \
  --input case_0000.nii.gz \
  --output-prefix predictions/case
```

Published MLX bundles already contain the converted weights. The model cards
describe each bundle's files and terms.
The CLI defaults to `--configuration 3d_fullres` and
`--source-profile nnunet-v2.8.1-default`; set these from `conversion.json` when they differ.

Supports 2D and 3D PlainConvUNet and ResidualEncoderUNet. Supply input channels in the model’s expected order.

## License

Apache-2.0; license and third-party notices are included in the distribution. Model weights retain their publisher terms.

For research and education. Outputs require human review.
