Token Classification
MLX
GLiNER
English
openmed
deberta-v2
apple-silicon
zero-shot-ner
medical
clinical
Instructions to use OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir OpenMed-ZeroShot-NER-Pharma-Small-166M-mlx OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M-mlx
- GLiNER
How to use OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M-mlx with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M-mlx") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
metadata
license: apache-2.0
base_model: OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M
pipeline_tag: token-classification
library_name: openmed
tags:
- openmed
- mlx
- apple-silicon
- zero-shot-ner
- gliner
- medical
- clinical
OpenMed-ZeroShot-NER-Pharma-Small-166M for OpenMed MLX
This repository contains an OpenMed MLX conversion of OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M for Apple Silicon inference with OpenMed.
Artifact metadata:
- OpenMed MLX task:
zero-shot-ner - OpenMed MLX family:
gliner-uni-encoder-span - Weight format:
safetensors - Runtime API:
GLiNERMLXPipeline
OpenMed is the main product experience:
- Install the Python package with
pip install openmed - Enable Apple Silicon acceleration with
pip install "openmed[mlx]" - Load this MLX model directly from the Hub or from a local snapshot
- For Apple apps, use OpenMedKit from the same GitHub repository with a compatible CoreML bundle
This MLX repo is meant to pair with:
- OpenMed GitHub: https://github.com/maziyarpanahi/openmed
- OpenMed website: https://openmed.life
- Source checkpoint:
OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M
Quick Start
pip install openmed
pip install "openmed[mlx]"
from huggingface_hub import snapshot_download
from openmed.mlx.inference import GLiNERMLXPipeline
model_path = snapshot_download("OpenMed/OpenMed-ZeroShot-NER-Pharma-Small-166M-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:
{
"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.
- Open Xcode and go to File > Add Package Dependencies.
- Paste the OpenMed repository URL:
https://github.com/maziyarpanahi/openmed - Choose the package product OpenMedKit from the repository.
- Add a compatible CoreML model bundle plus
id2label.jsonto 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-Pharma-Small-166M - OpenMed GitHub: https://github.com/maziyarpanahi/openmed
- OpenMed website: https://openmed.life
- MLX conversion and runtime support: OpenMed
- Swift runtime for Apple apps: OpenMedKit from the OpenMed repository