josand commited on
Commit
b20b3fd
·
verified ·
1 Parent(s): 56baf43

Clean model card and use MLX-Reason-CT naming

Browse files
Files changed (1) hide show
  1. README.md +139 -99
README.md CHANGED
@@ -1,116 +1,156 @@
1
  ---
2
  license: openmdw-1.1
 
 
3
  library_name: mlx
 
 
 
4
  tags:
5
- - medical-imaging
 
6
  - apple-silicon
7
- - research
8
- language:
9
- - en
 
 
 
 
 
10
  ---
11
- # NV-Reason-CT 386b93e0, FP32, chest structured report, greedy, max_new_tokens 512, thinking off
12
 
13
- Native MLX package: [MLX-Reason-CT](https://github.com/MedMLX/MLX-Reason-CT.git).
14
- Evaluated revision: `eb2c10baf688b32eee082dbb8973e88b4555db7a`.
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- This card describes the one configuration evaluated in the MedMLX paper. It is research software; the single-case comparison does not estimate clinical accuracy.
 
 
17
 
18
- ## Source and checkpoint
19
 
20
- Original publisher: NVIDIA.
21
- Original implementation: [https://huggingface.co/nvidia/NV-Reason-CT](https://huggingface.co/nvidia/NV-Reason-CT).
22
- Source revision or version: `386b93e034983f6c1fc841a43833a1b6a0cd9c13`.
23
- Original checkpoint: https://huggingface.co/nvidia/NV-Reason-CT/resolve/386b93e034983f6c1fc841a43833a1b6a0cd9c13/model.safetensors
24
 
25
- Conversion: mlx-reason-ct convert --source-dir <pinned snapshot> --output-dir work/runs/weights/nv-reason-ct (lossless BF16->FP32); the pre-existing radnn conversion was rejected by the package (engine radnn.nv_reason_ct_mlx.v1 differs from the pinned nv_reason_ct_mlx.fp32.v1).
26
- Conversion changes tensor layout or storage as specified by the native package; it does not retrain the model.
27
 
28
- ## Recorded example
 
29
 
30
- LUNA16 subset0 / 1.3.6.1.4.1.14519.5.2.1.6279.6001.105756658031515062000744821260
31
 
32
- ```python
33
- from mlx_reason_ct.medmlx import run
 
34
 
35
- # Replace file and directory names with your locally obtained inputs and weights.
36
- kwargs = {
37
- "image_path": "luna-case.nii.gz",
38
- "weights_path": "nv-reason-ct",
39
- "output_dir": "out",
40
- "anatomy_region": "chest",
41
- "overwrite": True
42
- }
43
- result = run(**kwargs)
44
- print(result["outputs"])
45
  ```
46
 
47
- Native result: **success**. Original-code comparison: **pass**, `token_identical` = `True`.
48
-
49
- The recorded CPU FP32 profile reproduces greedy output tokens. Do not generalize this comparison to the original CUDA BF16 profile or diagnostic accuracy.
50
-
51
- The complete [native run](native-run.json) and [original-code comparison](reference-comparison.json) retain commands, geometry, precision, and output-specific checks. Use the [replay harness](https://github.com/MedMLX/Med-MLX/blob/main/benchmarks/README.md) to substitute local paths. The package README documents installation and conversion.
52
-
53
- ## Distribution terms
54
-
55
- Upstream code: **OpenMDW-1.1**. Weights: **OpenMDW-1.1**.
56
- Converted weights are hosted in this repository.
57
-
58
- The recorded CPU FP32 profile reproduces greedy output tokens. Do not generalize this comparison to the original CUDA BF16 profile or diagnostic accuracy. Converted weights may retain the identified upstream license and required notices; the accompanying notices describe the redistribution terms.
59
-
60
- Full [upstream license](LICENSE) accompanies any weight distribution. The [retained component notices](THIRD_PARTY_NOTICES.md) accompany the prepared bundle.
61
-
62
- Required notices:
63
-
64
- - Retain the applicable license, copyright and attribution notices; identify the upstream checkpoint, authors, and MLX conversion changes.
65
- - Include OpenMDW-1.1 and retain all applicable copyright and origin notices, including component notices.
66
- - Retain component notices identified by radnn@cbaa1ac:THIRD_PARTY_NOTICES.md: NVIDIA 2026; Qwen/HuggingFace 2025; MLX/MLX-LM Apple MIT; MONAI, dynamic-network-architectures, timm and Transformers Apache-2.0; PyTorch/Caffe2 BSD; FlashAttention BSD-3-Clause.
67
-
68
- Review sources:
69
-
70
- - https://huggingface.co/nvidia/NV-Reason-CT
71
- - https://huggingface.co/nvidia/NV-Reason-CT/resolve/386b93e034983f6c1fc841a43833a1b6a0cd9c13/model.safetensors
72
- - https://huggingface.co/nvidia/NV-Reason-CT/blob/386b93e034983f6c1fc841a43833a1b6a0cd9c13/LICENSE
73
-
74
- ## Packaged files
75
-
76
- - `chat_template.jinja`
77
- - `config.json`
78
- - `generation_config.json`
79
- - `image_processor_3d/preprocessor_config.json`
80
- - `mlx/embedding.safetensors`
81
- - `mlx/layer_00.safetensors`
82
- - `mlx/layer_01.safetensors`
83
- - `mlx/layer_02.safetensors`
84
- - `mlx/layer_03.safetensors`
85
- - `mlx/layer_04.safetensors`
86
- - `mlx/layer_05.safetensors`
87
- - `mlx/layer_06.safetensors`
88
- - `mlx/layer_07.safetensors`
89
- - `mlx/layer_08.safetensors`
90
- - `mlx/layer_09.safetensors`
91
- - `mlx/layer_10.safetensors`
92
- - `mlx/layer_11.safetensors`
93
- - `mlx/layer_12.safetensors`
94
- - `mlx/layer_13.safetensors`
95
- - `mlx/layer_14.safetensors`
96
- - `mlx/layer_15.safetensors`
97
- - `mlx/layer_16.safetensors`
98
- - `mlx/layer_17.safetensors`
99
- - `mlx/layer_18.safetensors`
100
- - `mlx/layer_19.safetensors`
101
- - `mlx/layer_20.safetensors`
102
- - `mlx/layer_21.safetensors`
103
- - `mlx/layer_22.safetensors`
104
- - `mlx/layer_23.safetensors`
105
- - `mlx/layer_24.safetensors`
106
- - `mlx/layer_25.safetensors`
107
- - `mlx/layer_26.safetensors`
108
- - `mlx/layer_27.safetensors`
109
- - `mlx/layer_28.safetensors`
110
- - `mlx/layer_29.safetensors`
111
- - `mlx/layer_30.safetensors`
112
- - `mlx/layer_31.safetensors`
113
- - `mlx/manifest.json`
114
- - `mlx/norm.safetensors`
115
- - `mlx/vision.safetensors`
116
- - `tokenizer.json`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: openmdw-1.1
3
+ language:
4
+ - en
5
  library_name: mlx
6
+ base_model: nvidia/NV-Reason-CT
7
+ pipeline_tag: image-text-to-text
8
+ inference: false
9
  tags:
10
+ - mlx
11
+ - native-mlx
12
  - apple-silicon
13
+ - fp32
14
+ - ct
15
+ - medical-imaging
16
+ - nv-reason-ct
17
+ - 3d-vlm
18
+ - vision-language
19
+ - radiology
20
+ - report-generation
21
  ---
 
22
 
23
+ # MLX-Reason-CT
24
+
25
+ Native MLX port of [NVIDIA NV-Reason-CT](https://huggingface.co/nvidia/NV-Reason-CT)
26
+ for Apple Silicon. Run 3D CT reasoning and report generation locally on Mac.
27
+
28
+ - Chest and abdomen CT
29
+ - Structured reports and CT question answering
30
+ - Local NIfTI input with Apple Silicon GPU acceleration
31
+ - FP32 by default, with explicit BF16 arithmetic profiles on Metal
32
+
33
+ MLX port by **Joseph Sandoval**.
34
+ [GitHub releases](https://github.com/MedMLX/MLX-Reason-CT/releases) ·
35
+ [Usage](https://github.com/MedMLX/MLX-Reason-CT/blob/v0.2.4/docs/usage.md) ·
36
+ [Paper](https://arxiv.org/abs/2609.27511) ·
37
+ [Public reference card](https://huggingface.co/josand/MLX-Reason-CT)
38
 
39
+ **Requires the companion `mlx-reason-ct` runtime.** Follow the quick start below.
40
+ Hugging Face's generated "Use this model" snippet uses `mlx-vlm`, which does not
41
+ support this 3D CT architecture; generic `mlx-lm` loaders are also incompatible.
42
 
43
+ ## Requirements
44
 
45
+ Supported platform: macOS arm64 on an Apple Silicon Mac with Metal GPU access,
46
+ Python 3.12 and [uv](https://docs.astral.sh/uv/). Inference fails explicitly when
47
+ Metal is unavailable.
 
48
 
49
+ `v0.2.4` uses the public Apache-2.0 `medmlx-core==0.1.2` runtime from PyPI.
 
50
 
51
+ Weights occupy 17.4 GB. Measured peak MLX memory use is about 22.7 GB;
52
+ allow additional unified memory for preprocessing, macOS and other apps.
53
 
54
+ ## Quick start
55
 
56
+ ```bash
57
+ uv tool install --python 3.12 \
58
+ https://github.com/MedMLX/MLX-Reason-CT/releases/download/v0.2.4/mlx_reason_ct-0.2.4-py3-none-any.whl
59
 
60
+ uvx --from huggingface_hub hf download MedMLX/MLX-Reason-CT --local-dir models
 
 
 
 
 
 
 
 
 
61
  ```
62
 
63
+ Authenticate with `hf auth login` if repository access is required.
64
+
65
+ Generate a chest CT report:
66
+
67
+ ```bash
68
+ mlx-reason-ct report \
69
+ --input ct.nii.gz --model-dir models --output-dir outputs
70
+ ```
71
+
72
+ For abdomen CT:
73
+
74
+ ```bash
75
+ mlx-reason-ct report \
76
+ --input ct.nii.gz --model-dir models --output-dir outputs \
77
+ --anatomy-region abdomen
78
+ ```
79
+
80
+ To ask a question about the CT, set `--prompt` to your question.
81
+
82
+ For an existing Python 3.12 environment, use `pip install` with the same release-wheel URL.
83
+ Wheel and source archives are also available in the
84
+ [GitHub release](https://github.com/MedMLX/MLX-Reason-CT/releases/tag/v0.2.4).
85
+ For source development, clone [the repository](https://github.com/MedMLX/MLX-Reason-CT)
86
+ and run `make env`; use `uv run mlx-reason-ct` for the commands above.
87
+ The source checkout additionally supports plain centered cropping and follow-up
88
+ history, which are not in 0.2.4; see the
89
+ [source usage guide](https://github.com/MedMLX/MLX-Reason-CT/blob/main/docs/usage.md).
90
+
91
+ For a generated input with no patient data, follow the
92
+ [synthetic CT walkthrough](https://github.com/MedMLX/MLX-Reason-CT/blob/v0.2.4/docs/synthetic-walkthrough.md).
93
+ It covers installation, bundle verification, input generation and completion checks.
94
+
95
+ ## Input and output
96
+
97
+ Input is one 3D CT volume in NIfTI format (`.nii` or `.nii.gz`) with Hounsfield
98
+ Unit values and valid spatial geometry. DICOM and 2D images are unsupported.
99
+
100
+ The upstream crop locates the chest from enclosed air. On whole-body scans,
101
+ especially with arms raised, it can select the head and neck instead; crop such
102
+ volumes to the chest or abdomen before running.
103
+
104
+ Each run writes:
105
+
106
+ - `report.txt` — generated response
107
+ - `model_response.json` — response, reasoning (with `--enable-thinking`) and generation metadata
108
+ - `run.json` — execution metadata
109
+
110
+ Version 0.2.4 removes a trailing empty `<answer></answer>` element from the saved
111
+ report in both text and JSON, while preserving reasoning and nonempty answer elements.
112
+
113
+ ## Technical details
114
+
115
+ This repository contains the converted organization bundle sourced from NVIDIA
116
+ revision `386b93e034983f6c1fc841a43833a1b6a0cd9c13`, using lossless BF16-to-FP32
117
+ expansion and the `nv_reason_ct_mlx.fp32.v1` format. No retraining was performed.
118
+
119
+ The retained LUNA16 chest comparison used greedy generation, 512 maximum new
120
+ tokens and thinking disabled. It completed successfully and reproduced the
121
+ reference CPU FP32 output tokens. This does not establish equivalence to the
122
+ original CUDA BF16 profile or estimate diagnostic accuracy.
123
+
124
+ [Native run](https://huggingface.co/MedMLX/MLX-Reason-CT/blob/main/native-run.json) ·
125
+ [Original-code comparison](https://huggingface.co/MedMLX/MLX-Reason-CT/blob/main/reference-comparison.json).
126
+ Evaluated package revision: `eb2c10baf688b32eee082dbb8973e88b4555db7a`.
127
+
128
+ Inference defaults to FP32 with weights converted directly from the
129
+ original BF16 checkpoint, without retraining.
130
+ [Implementation and verification details](https://github.com/MedMLX/MLX-Reason-CT/blob/v0.2.4/docs/usage.md),
131
+ and the limits of its darwin-arm64 component references are in the companion repository.
132
+ [Upstream model card and limitations](https://huggingface.co/nvidia/NV-Reason-CT).
133
+
134
+ Version 0.2.3 includes faster source-BF16 projection and attention kernels.
135
+ On one M1 Max synthetic case, cached full-model time fell from 17:54 in the
136
+ preceding source build to 14:49, with bitwise-unchanged recorded outputs.
137
+ Full BF16 qualification remains incomplete; see the
138
+ [benchmark and limits](https://github.com/MedMLX/MLX-Reason-CT/blob/v0.2.3/docs/verification.md#source-bf16-optimization-measurement-2026-10-09).
139
+
140
+ ## Intended use
141
+
142
+ Intended for research and education, not clinical diagnosis or treatment decisions.
143
+ Outputs require human review.
144
+
145
+ ## License
146
+
147
+ Weights: [OpenMDW-1.1](https://huggingface.co/MedMLX/MLX-Reason-CT/blob/main/LICENSE),
148
+ Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
149
+ Underlying Qwen3.5 terms: [Apache-2.0](https://huggingface.co/josand/MLX-Reason-CT/blob/main/APACHE-2.0.txt).
150
+
151
+ Port code: [Apache-2.0](https://github.com/MedMLX/MLX-Reason-CT/blob/main/LICENSE),
152
+ Copyright (c) 2026 Joseph Sandoval.
153
+ [Third-party notices](https://github.com/MedMLX/MLX-Reason-CT/blob/main/THIRD_PARTY_NOTICES.md).
154
+
155
+ The hosted bundle retains [attribution](https://huggingface.co/MedMLX/MLX-Reason-CT/blob/main/NOTICE)
156
+ and [component notices](https://huggingface.co/MedMLX/MLX-Reason-CT/blob/main/THIRD_PARTY_NOTICES.md).