File size: 3,380 Bytes
7eedc71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47dac37
 
42bafbe
 
47dac37
 
 
 
 
42bafbe
7eedc71
42bafbe
47dac37
 
 
 
 
 
 
7eedc71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
license: apache-2.0
base_model: OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M
pipeline_tag: token-classification
library_name: openmed
tags:
  - openmed
  - mlx
  - apple-silicon
  - zero-shot-ner
  - gliner
  - medical
  - clinical
---

# OpenMed-ZeroShot-NER-DNA-Large-459M for OpenMed MLX

This repository contains an OpenMed MLX conversion of [`OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M`](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M) for Apple Silicon inference with [OpenMed](https://github.com/maziyarpanahi/openmed).

Artifact metadata:

- OpenMed MLX task: `zero-shot-ner`
- OpenMed MLX family: `gliner-uni-encoder-span`
- Weight format: `safetensors`
- Runtime API: `GLiNERMLXPipeline`

## OpenMed MLX Status

- MLX rollout: refreshed for public access on 2026-06-23
- Hub artifact: OpenMed MLX repository
- Source checkpoint: [`OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M`](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M)
- Collection: [OpenMed Medical MLX Models](https://huggingface.co/collections/OpenMed/medical-mlx-models)
- Runtime: OpenMed Python MLX backend on Apple Silicon
- Artifact layout: `config.json`, `id2label.json`, `openmed-mlx.json`, MLX weights, and tokenizer assets

## Use This MLX Snapshot

Download this OpenMed MLX artifact directly from the Hub:

```bash
hf download OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M-mlx --local-dir ./OpenMed-ZeroShot-NER-DNA-Large-459M-mlx
```

Use the downloaded directory when you want to pin this exact MLX artifact in an offline or local Apple Silicon workflow.

## Quick Start

```bash
pip install openmed
pip install "openmed[mlx]"
```

```python
from huggingface_hub import snapshot_download
from openmed.mlx.inference import GLiNERMLXPipeline

model_path = snapshot_download("OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M-mlx")
pipe = GLiNERMLXPipeline(model_path)

entities = pipe.predict_entities(
    "Patient John Doe was seen at Stanford Hospital.",
    labels=["person", "organization", "location"],
    threshold=0.5,
)

for entity in entities:
    print(entity)
```

Prompt packing metadata included with the model:

```json
{
  "kind": "gliner-words",
  "entity_token": "<<ENT>>",
  "separator_token": "<<SEP>>",
  "class_token_index": 128002,
  "embed_marker_token": true,
  "split_mode": "words"
}
```

## Swift and Apple Apps

Use Swift with OpenMedKit, not with MLX weight files directly.

1. Open Xcode and go to File > Add Package Dependencies.
2. Paste the OpenMed repository URL: `https://github.com/maziyarpanahi/openmed`
3. Choose the package product OpenMedKit from the repository.
4. Add a compatible CoreML model bundle plus `id2label.json` to your app target.

This MLX model is for Python services on Apple Silicon, local MLX inference on macOS, and Hub-hosted model distribution. If a given environment cannot write `weights.safetensors`, OpenMed falls back to `weights.npz` so the model remains usable.

## Credits

- Base checkpoint: [`OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M`](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-DNA-Large-459M)
- OpenMed GitHub: [https://github.com/maziyarpanahi/openmed](https://github.com/maziyarpanahi/openmed)
- OpenMed website: [https://openmed.life](https://openmed.life)
- MLX conversion and runtime support: OpenMed
- Swift runtime for Apple apps: OpenMedKit from the OpenMed repository