Skip to main content

biomedparse-mlx

Native MLX port of Microsoft BioMedParse v2 for Apple Silicon. Segment medical images from text prompts, locally on Mac.

  • Text-guided 3D segmentation with multiple prompts and labels
  • Raw NIfTI and DICOM windowing, with geometry-preserving NIfTI mask output
  • Float32 model execution on Metal; PyTorch is used for conversion and oracle tests
  • A 2D image path with overlapping prompt masks; dedicated 2D weights remain unqualified

Part of MedMLX. Technical notes · Usage

Quick start · Input and output · Technical details · License

Requirements

Apple Silicon Mac with Metal, Python 3.13 or 3.14 and uv. The released checkpoint requires access to the gated Microsoft model on Hugging Face.

Quick start

Prepare the locked checkout and local checkpoint assets:

gh repo clone MedMLX/biomedparse-mlx
cd biomedparse-mlx
make env
MACOSX_DEPLOYMENT_TARGET=27.0 uv sync --locked --extra dev --extra oracle --extra conversion --extra assets

uv run --locked --no-sync hf download microsoft/BiomedParse biomedparse_v2.ckpt \
  --revision e473e5b2b1a3f44649734afd3dc7cf1770aaa9e2 --local-dir weights/source
uv run --locked --no-sync hf download openai/clip-vit-base-patch32 tokenizer.json \
  --revision 3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268 --local-dir weights

uv run --locked --no-sync biomedparse-mlx convert \
  --source weights/source/biomedparse_v2.ckpt --output weights/biomedparse-v2.npz

The source checkpoint is about 4.46 GB. Conversion writes a float32 tensor bundle and a versioned receipt. Inference uses local assets without implicit downloads.

Segment a preprocessed volume:

uv run --locked --no-sync biomedparse-mlx segment \
  --image scan.npy --weights weights/biomedparse-v2.npz --tokenizer weights/tokenizer.json \
  --prompt 'Visualization of the liver in abdominal CT imaging' --label 6 \
  --output-dir outputs/liver --slice-batch-size 2 --seed 7

Repeat --prompt and --label for multiple structures. Existing outputs require --overwrite. Python usage, raw-image windowing, instance segmentation and the segment-2d command are described in docs/usage.md. The model is discoverable by medmlx as biomedparse-v2.

Input and output

Volumes are preprocessed numeric .npy arrays or .npz files containing imgs in the upstream 0..255 intensity range. Raw NIfTI volumes and DICOM slices require explicit --modality and, for CT, --ct-site windowing options. Volume slicing follows upstream's fixed shape heuristic.

The volume path writes segmentation.npz with uint16 labels on the original array grid, prompt-by-slice existence probabilities, and run.json. NIfTI inputs also produce segmentation.nii.gz on the source affine. The 2D path returns separate, potentially overlapping masks and probabilities per prompt.

Technical details

The native graph follows the pinned BioMedParse v2 architecture and checkpoint contract. Controlled oracle comparisons replay upstream attention masks; matching integer seeds alone does not align Torch and MLX sampling. Recorded qualification covers bounded synthetic and AMOS cases. Dedicated 2D weights, broader task accuracy and clinical performance remain unqualified.

Architecture, numerical tolerances, development checks and recorded measurements are in docs/technical.md.

Intended use

Intended for research and education, not clinical diagnosis or treatment decisions. Outputs require human review.

License

Original contributions: Apache-2.0; see LICENSE. Upstream MIT/BSD notices and full license texts are retained in THIRD_PARTY_NOTICES.md. Model weights have separate publisher terms: Microsoft's model card declares CC-BY-NC-SA-4.0. Weights, tokenizers, datasets and masks are excluded from Git.

Implementation mapping

Central implementation map records upstream-to-native changes, source references and qualification scope.

Metadata

Release files for biomedparse-mlx 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biomedparse-mlx 0.1.1
File Size Uploaded Provenance
biomedparse_mlx-0.1.1.tar.gz 39.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for biomedparse-mlx 0.1.1
File Interpreter ABI Platform
biomedparse_mlx-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 90.9 kB

Release files / biomedparse_mlx-0.1.1.tar.gz

Download URL biomedparse_mlx-0.1.1.tar.gz
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
61aa9197e49873329ff73dad17887a12ba44c4f8e3da9202612c5f517957c267
BLAKE2b-256 checksum
How to use checksums
05836c21fc6abb2ac6f96ea2c26d6c2947af4440ab256b4ef7f9121e2269af91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Release files / biomedparse_mlx-0.1.1-py3-none-any.whl

Download URL biomedparse_mlx-0.1.1-py3-none-any.whl
Size 51.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f05725e90f97967e8b3ed27059ade5bd2a7b4078ee4c3fbbbb8f9a423909b7e
BLAKE2b-256 checksum
How to use checksums
d62c7e0b55d9e29443e849860c0a5e28d3925c6ff4688412b65ae66a7058cd10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Security for biomedparse-mlx 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page