Image-Text-to-Text
Safetensors
MLX
openmed
cohere_compass
openmedkit
apple-silicon
ios
on-device
vision
multimodal
clinical
medical
privacy
native-resolution
conversational
8-bit precision
Instructions to use OpenMed/North-Micro-Vision-Instruct-8bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OpenMed/North-Micro-Vision-Instruct-8bit-mlx with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("OpenMed/North-Micro-Vision-Instruct-8bit-mlx") config = load_config("OpenMed/North-Micro-Vision-Instruct-8bit-mlx") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Use OpenMed runtime guidance
Browse files- README.md +6 -11
- openmed-mlx.json +0 -6
- openmed-runtime-validation.json +1 -1
- openmed-validation.json +18 -18
README.md
CHANGED
|
@@ -38,8 +38,8 @@ including local clinical-document and chart workflows on Mac, iPhone, and iPad.
|
|
| 38 |
These repositories contain MLX conversions of
|
| 39 |
[`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct),
|
| 40 |
a compact 2.4B-parameter Cohere Compass vision-language model released under
|
| 41 |
-
Apache 2.0. OpenMed
|
| 42 |
-
|
| 43 |
|
| 44 |
The same byte-identical README is published across all five precision
|
| 45 |
variants. The repository name, `config.json`, and `openmed-mlx.json` identify
|
|
@@ -62,12 +62,10 @@ while reducing the decoder footprint.
|
|
| 62 |
|
| 63 |
## Python through OpenMed
|
| 64 |
|
| 65 |
-
Install
|
| 66 |
-
linked implementation PR is merged and released, install its tested branch:
|
| 67 |
|
| 68 |
```bash
|
| 69 |
-
|
| 70 |
-
"openmed[mlx] @ git+https://github.com/maziyarpanahi/openmed.git@feature/cohere-compass-runtime"
|
| 71 |
```
|
| 72 |
|
| 73 |
Image plus text:
|
|
@@ -237,12 +235,9 @@ incorrect, or fabricated. A qualified human must verify consequential use.
|
|
| 237 |
- Source: [`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct)
|
| 238 |
- Pinned source revision: `373bda96ac70bf89f99f7048f420cf00dc07c149`
|
| 239 |
- OpenMed / OpenMedKit: [github.com/maziyarpanahi/openmed](https://github.com/maziyarpanahi/openmed)
|
| 240 |
-
- Independent conversion reference: the Cohere Compass port contributed to
|
| 241 |
-
MLX-VLM at revision `dd79a5d8caf3edafd6fa9e6326d7ce4977ddcbfc`
|
| 242 |
|
| 243 |
-
Thank you to Cohere for releasing North Micro Vision and to the
|
| 244 |
-
|
| 245 |
-
reference while OpenMed implemented and tested its own Python and Swift paths.
|
| 246 |
|
| 247 |
The converted weights retain the source model's Apache 2.0 license. OpenMed's
|
| 248 |
SDK source is separately licensed under Apache 2.0.
|
|
|
|
| 38 |
These repositories contain MLX conversions of
|
| 39 |
[`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct),
|
| 40 |
a compact 2.4B-parameter Cohere Compass vision-language model released under
|
| 41 |
+
Apache 2.0. OpenMed provides the Python and Swift runtime paths described here
|
| 42 |
+
and consumes the repositories as data-only model artifacts.
|
| 43 |
|
| 44 |
The same byte-identical README is published across all five precision
|
| 45 |
variants. The repository name, `config.json`, and `openmed-mlx.json` identify
|
|
|
|
| 62 |
|
| 63 |
## Python through OpenMed
|
| 64 |
|
| 65 |
+
Install OpenMed with Apple MLX support:
|
|
|
|
| 66 |
|
| 67 |
```bash
|
| 68 |
+
uv pip install "openmed[mlx]"
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
Image plus text:
|
|
|
|
| 235 |
- Source: [`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct)
|
| 236 |
- Pinned source revision: `373bda96ac70bf89f99f7048f420cf00dc07c149`
|
| 237 |
- OpenMed / OpenMedKit: [github.com/maziyarpanahi/openmed](https://github.com/maziyarpanahi/openmed)
|
|
|
|
|
|
|
| 238 |
|
| 239 |
+
Thank you to Cohere for releasing North Micro Vision and to the Apple MLX
|
| 240 |
+
contributors who make private on-device inference possible.
|
|
|
|
| 241 |
|
| 242 |
The converted weights retain the source model's Apache 2.0 license. OpenMed's
|
| 243 |
SDK source is separately licensed under Apache 2.0.
|
openmed-mlx.json
CHANGED
|
@@ -38,11 +38,5 @@
|
|
| 38 |
"weights": {
|
| 39 |
"format": "safetensors",
|
| 40 |
"path": "model.safetensors"
|
| 41 |
-
},
|
| 42 |
-
"provenance": {
|
| 43 |
-
"independent_conversion_reference": {
|
| 44 |
-
"library": "mlx-vlm",
|
| 45 |
-
"revision": "dd79a5d8caf3edafd6fa9e6326d7ce4977ddcbfc"
|
| 46 |
-
}
|
| 47 |
}
|
| 48 |
}
|
|
|
|
| 38 |
"weights": {
|
| 39 |
"format": "safetensors",
|
| 40 |
"path": "model.safetensors"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
}
|
| 42 |
}
|
openmed-runtime-validation.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
| 20 |
"huggingface-hub": "1.27.0",
|
| 21 |
"pillow": "12.3.0"
|
| 22 |
},
|
| 23 |
-
"test": "tests/integration/
|
| 24 |
},
|
| 25 |
"swift": {
|
| 26 |
"passed": true,
|
|
|
|
| 20 |
"huggingface-hub": "1.27.0",
|
| 21 |
"pillow": "12.3.0"
|
| 22 |
},
|
| 23 |
+
"test": "tests/integration/test_mlx_vision_language_compass.py"
|
| 24 |
},
|
| 25 |
"swift": {
|
| 26 |
"passed": true,
|
openmed-validation.json
CHANGED
|
@@ -3,29 +3,29 @@
|
|
| 3 |
{
|
| 4 |
"coherence_detail": "coherent surface form",
|
| 5 |
"coherent": true,
|
| 6 |
-
"elapsed_seconds": 0.
|
| 7 |
"fact_detail": "privacy/locality concepts present",
|
| 8 |
"facts_correct": true,
|
| 9 |
"fixture": null,
|
| 10 |
-
"generation_tokens":
|
| 11 |
"id": "text_privacy",
|
| 12 |
"passed": true,
|
| 13 |
-
"peak_memory_gb": 3.
|
| 14 |
"prompt": "In one concise sentence, explain how running a vision-language model entirely on-device can improve privacy for clinical documents.",
|
| 15 |
"prompt_tokens": 30,
|
| 16 |
-
"response": "Running a vision-language model entirely on-device
|
| 17 |
},
|
| 18 |
{
|
| 19 |
"coherence_detail": "coherent surface form",
|
| 20 |
"coherent": true,
|
| 21 |
-
"elapsed_seconds": 0.
|
| 22 |
"fact_detail": "all expected facts present",
|
| 23 |
"facts_correct": true,
|
| 24 |
"fixture": null,
|
| 25 |
-
"generation_tokens":
|
| 26 |
"id": "text_fact_extraction",
|
| 27 |
"passed": true,
|
| 28 |
-
"peak_memory_gb": 3.
|
| 29 |
"prompt": "A synthetic note states: \"The follow-up appointment is scheduled for Tuesday at 10:30 AM.\" What day is the follow-up? Answer with only the day.",
|
| 30 |
"prompt_tokens": 44,
|
| 31 |
"response": "Tuesday"
|
|
@@ -33,29 +33,29 @@
|
|
| 33 |
{
|
| 34 |
"coherence_detail": "coherent surface form",
|
| 35 |
"coherent": true,
|
| 36 |
-
"elapsed_seconds":
|
| 37 |
"fact_detail": "all expected facts present",
|
| 38 |
"facts_correct": true,
|
| 39 |
"fixture": "synthetic_clinical_document.png",
|
| 40 |
-
"generation_tokens":
|
| 41 |
"id": "image_clinical_document",
|
| 42 |
"passed": true,
|
| 43 |
-
"peak_memory_gb": 5.
|
| 44 |
"prompt": "This is synthetic test data. In one concise sentence, report the exact patient name, record ID, medication with dose and frequency, and allergy shown in the image.",
|
| 45 |
"prompt_tokens": 1161,
|
| 46 |
-
"response": "The synthetic test data includes patient Alex Rivera
|
| 47 |
},
|
| 48 |
{
|
| 49 |
"coherence_detail": "coherent surface form",
|
| 50 |
"coherent": true,
|
| 51 |
-
"elapsed_seconds": 0.
|
| 52 |
"fact_detail": "all expected facts present",
|
| 53 |
"facts_correct": true,
|
| 54 |
"fixture": "synthetic_clinic_chart.png",
|
| 55 |
-
"generation_tokens":
|
| 56 |
"id": "image_chart",
|
| 57 |
"passed": true,
|
| 58 |
-
"peak_memory_gb": 5.
|
| 59 |
"prompt": "Which category has the tallest bar, and what exact value is printed above it? Answer concisely.",
|
| 60 |
"prompt_tokens": 1053,
|
| 61 |
"response": "Screening, 42"
|
|
@@ -69,16 +69,16 @@
|
|
| 69 |
"memory_size": 549755813888,
|
| 70 |
"resource_limit": 499000
|
| 71 |
},
|
| 72 |
-
"load_seconds":
|
| 73 |
-
"
|
| 74 |
-
"model_path": "OpenMed/North-Micro-Vision-Instruct-8bit-mlx",
|
| 75 |
"passed": true,
|
|
|
|
| 76 |
"runtime_versions": {
|
| 77 |
"huggingface-hub": "1.27.0",
|
| 78 |
"mlx": "0.32.0",
|
| 79 |
"mlx-lm": "0.31.3",
|
| 80 |
"mlx-metal": "0.32.0",
|
| 81 |
-
"
|
| 82 |
"transformers": "5.15.0"
|
| 83 |
},
|
| 84 |
"schema_version": 1,
|
|
|
|
| 3 |
{
|
| 4 |
"coherence_detail": "coherent surface form",
|
| 5 |
"coherent": true,
|
| 6 |
+
"elapsed_seconds": 0.423,
|
| 7 |
"fact_detail": "privacy/locality concepts present",
|
| 8 |
"facts_correct": true,
|
| 9 |
"fixture": null,
|
| 10 |
+
"generation_tokens": 37,
|
| 11 |
"id": "text_privacy",
|
| 12 |
"passed": true,
|
| 13 |
+
"peak_memory_gb": 3.23761089,
|
| 14 |
"prompt": "In one concise sentence, explain how running a vision-language model entirely on-device can improve privacy for clinical documents.",
|
| 15 |
"prompt_tokens": 30,
|
| 16 |
+
"response": "Running a vision-language model entirely on-device can improve privacy for clinical documents by reducing the need to transmit sensitive data over the internet, thus minimizing the risk of data breaches and unauthorized access."
|
| 17 |
},
|
| 18 |
{
|
| 19 |
"coherence_detail": "coherent surface form",
|
| 20 |
"coherent": true,
|
| 21 |
+
"elapsed_seconds": 0.0375,
|
| 22 |
"fact_detail": "all expected facts present",
|
| 23 |
"facts_correct": true,
|
| 24 |
"fixture": null,
|
| 25 |
+
"generation_tokens": 1,
|
| 26 |
"id": "text_fact_extraction",
|
| 27 |
"passed": true,
|
| 28 |
+
"peak_memory_gb": 3.281032518,
|
| 29 |
"prompt": "A synthetic note states: \"The follow-up appointment is scheduled for Tuesday at 10:30 AM.\" What day is the follow-up? Answer with only the day.",
|
| 30 |
"prompt_tokens": 44,
|
| 31 |
"response": "Tuesday"
|
|
|
|
| 33 |
{
|
| 34 |
"coherence_detail": "coherent surface form",
|
| 35 |
"coherent": true,
|
| 36 |
+
"elapsed_seconds": 1.2672,
|
| 37 |
"fact_detail": "all expected facts present",
|
| 38 |
"facts_correct": true,
|
| 39 |
"fixture": "synthetic_clinical_document.png",
|
| 40 |
+
"generation_tokens": 31,
|
| 41 |
"id": "image_clinical_document",
|
| 42 |
"passed": true,
|
| 43 |
+
"peak_memory_gb": 5.843571694,
|
| 44 |
"prompt": "This is synthetic test data. In one concise sentence, report the exact patient name, record ID, medication with dose and frequency, and allergy shown in the image.",
|
| 45 |
"prompt_tokens": 1161,
|
| 46 |
+
"response": "The synthetic test data includes patient Alex Rivera (Record ID: SYN-2048), prescribed Metformin 500 mg twice daily, with a penicillin allergy."
|
| 47 |
},
|
| 48 |
{
|
| 49 |
"coherence_detail": "coherent surface form",
|
| 50 |
"coherent": true,
|
| 51 |
+
"elapsed_seconds": 0.8766,
|
| 52 |
"fact_detail": "all expected facts present",
|
| 53 |
"facts_correct": true,
|
| 54 |
"fixture": "synthetic_clinic_chart.png",
|
| 55 |
+
"generation_tokens": 4,
|
| 56 |
"id": "image_chart",
|
| 57 |
"passed": true,
|
| 58 |
+
"peak_memory_gb": 5.843571694,
|
| 59 |
"prompt": "Which category has the tallest bar, and what exact value is printed above it? Answer concisely.",
|
| 60 |
"prompt_tokens": 1053,
|
| 61 |
"response": "Screening, 42"
|
|
|
|
| 69 |
"memory_size": 549755813888,
|
| 70 |
"resource_limit": 499000
|
| 71 |
},
|
| 72 |
+
"load_seconds": 2.9559,
|
| 73 |
+
"model_path": "/Users/maziyar/Developer/openmed-mlx-export/artifacts/north-micro-vision/North-Micro-Vision-Instruct-8bit-mlx",
|
|
|
|
| 74 |
"passed": true,
|
| 75 |
+
"runtime": "openmed.mlx.OpenMedMLXVisionLanguageModel",
|
| 76 |
"runtime_versions": {
|
| 77 |
"huggingface-hub": "1.27.0",
|
| 78 |
"mlx": "0.32.0",
|
| 79 |
"mlx-lm": "0.31.3",
|
| 80 |
"mlx-metal": "0.32.0",
|
| 81 |
+
"openmed": "1.0.0",
|
| 82 |
"transformers": "5.15.0"
|
| 83 |
},
|
| 84 |
"schema_version": 1,
|