File size: 4,514 Bytes
94e3edd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671cfcf
 
28c03fe
 
671cfcf
 
 
 
 
038f213
 
 
 
 
 
 
 
 
 
94e3edd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
license: apache-2.0
base_model: OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1
pipeline_tag: token-classification
library_name: openmed
tags:
  - openmed
  - mlx
  - apple-silicon
  - token-classification
  - pii
  - de-identification
  - medical
  - clinical
  - bert
---

# OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1 for OpenMed MLX

This repository contains an MLX packaging of [`OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1) for Apple Silicon inference with [OpenMed](https://github.com/maziyarpanahi/openmed).

## At a Glance

- Source checkpoint: [`OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1)
- Model family: `bert` (`BertForTokenClassification`)
- Primary language hint: Portuguese (`pt`)
- Artifact layout: legacy-compatible MLX (`config.json`, `id2label.json`, MLX weight files)
- Weight format: `safetensors`
- Python MLX: supported through `openmed[mlx]` on Apple Silicon Macs

## OpenMed MLX Status

- MLX rollout: refreshed for public access on 2026-06-23
- Hub artifact: OpenMed MLX repository
- Source checkpoint: [`OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1)
- 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-PII-Portuguese-ClinicalBGE-Large-335M-v1-mlx --local-dir ./OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1-mlx
```

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

## Python Quick Start

Use the standard OpenMed API if you want OpenMed to choose the right runtime automatically:

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

```python
from openmed import extract_pii

text = "<your clinical note here>"
result = extract_pii(
    text,
    model_name="OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1",
    use_smart_merging=True,
)

for entity in result.entities:
    print(entity.label, entity.text, round(entity.confidence, 4))
```

On Apple Silicon, OpenMed can use this preconverted MLX artifact when `openmed[mlx]` is installed. On other systems, OpenMed falls back to the Hugging Face / PyTorch backend.

## Use This Preconverted MLX Repo Directly

If you want to use this MLX snapshot explicitly, download it locally and point OpenMed at the directory:

```bash
pip install "openmed[mlx]"
hf download OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1-mlx --local-dir ./OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1-mlx
```


```python
from openmed import extract_pii
from openmed.core import OpenMedConfig

text = "<your clinical note here>"
result = extract_pii(
    text,
    model_name="./OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1-mlx",
    config=OpenMedConfig(backend="mlx"),
    use_smart_merging=True,
)

print(result.entities)
```

## Swift Status

This repo is based on `bert`. Python MLX supports this artifact today, and this family is in the current OpenMedKit Swift MLX support matrix.

If you are building an Apple app today, the recommended paths for this model are:

- Python MLX for evaluation or local workflows on Apple Silicon
- CoreML in OpenMedKit if you already have a compatible bundled Apple export
- Track the current Swift support matrix in the [OpenMedKit docs](https://openmed.life/docs/swift-openmedkit/)

## Artifact Notes

This repo uses the current legacy-compatible MLX layout:

- `config.json`
- `id2label.json`
- MLX weight files (`weights.safetensors` and/or `weights.npz`)

Tokenizer assets are bundled in this repo.

## Links

- Source checkpoint: [`OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-ClinicalBGE-Large-335M-v1)
- OpenMed GitHub: [https://github.com/maziyarpanahi/openmed](https://github.com/maziyarpanahi/openmed)
- MLX backend docs: [https://openmed.life/docs/mlx-backend/](https://openmed.life/docs/mlx-backend/)
- OpenMedKit docs: [https://openmed.life/docs/swift-openmedkit/](https://openmed.life/docs/swift-openmedkit/)