MaziyarPanahi's picture
Upload MLX packaging for OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1-mlx
2448768 verified
|
Raw
History Blame
3.83 kB
---
license: apache-2.0
base_model: OpenMed/OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1
pipeline_tag: token-classification
library_name: openmed
tags:
- openmed
- mlx
- apple-silicon
- token-classification
- pii
- de-identification
- medical
- clinical
- deberta-v2
---
# OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1 for OpenMed MLX
This repository contains an MLX packaging of [`OpenMed/OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1) for Apple Silicon inference with [OpenMed](https://github.com/maziyarpanahi/openmed).
## At a Glance
- Source checkpoint: [`OpenMed/OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1)
- Model family: `deberta-v2` (`DebertaV2ForTokenClassification`)
- 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
## 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-mSuperClinical-Large-279M-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-mSuperClinical-Large-279M-v1-mlx --local-dir ./OpenMed-PII-Portuguese-mSuperClinical-Large-279M-v1-mlx
```
If this repo is private in your environment, authenticate first with `hf auth login` or set `HF_TOKEN`.
```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-mSuperClinical-Large-279M-v1-mlx",
config=OpenMedConfig(backend="mlx"),
use_smart_merging=True,
)
print(result.entities)
```
## Swift Status
This repo is based on `deberta-v2`. Python MLX supports this artifact today, but the current public OpenMedKit Swift MLX rollout is limited to `bert`, `distilbert`, `roberta`, `xlm-roberta`, and `electra`.
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-mSuperClinical-Large-279M-v1`](https://huggingface.co/OpenMed/OpenMed-PII-Portuguese-mSuperClinical-Large-279M-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/)