
Running Zeroshot Ner
Extract arbitrary, custom entity types from clinical or biomedical text with no...
Install
npx skills add maziyarpanahi/openmed --skill running-zeroshot-ner -g -a claude-code -y- Repository
- maziyarpanahi/openmed5.8k
- Category
- Engineering
- Updated
- 4d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 1,514 tokens
- Runs scripts
- No, instructions only
What it does
Extract arbitrary, custom entity types from clinical or biomedical text with no fine-tuning using OpenMed's GLiNER / GLiNER2 zero-shot support. Use when the user wants to define their own labels on the fly (e.g. Drug, Symptom, Device, Procedure), has no labelled data or a label set not covered by a fine-tuned model, or asks about openmed zero deps/index/infer, the gliner extra, or GLiNER. Pairs adjacent to extracting-clinical-entities (use that for high-accuracy fixed-schema NER) and loading-openmed-models.
Running Zero-Shot NER
Zero-shot NER lets you extract entity types you name at inference time, no
training, no labelled data. OpenMed wraps GLiNER (v1) and GLiNER2 behind a small
index + inference layer, exposed via the openmed zero CLI and the openmed.ner
Python API. It runs on-device.
When to use
- Your label set is custom or evolving ("Device", "Implant", "Allergen") and no fine-tuned OpenMed model emits exactly those labels.
- You have no labelled data to fine-tune with.
- You need a quick prototype or a one-off extraction over an unusual schema.
When to prefer a fine-tuned model instead (extracting-clinical-entities):
for a fixed, well-supported schema (diseases, drugs, anatomy), a fine-tuned
OpenMed model is more accurate and faster than zero-shot. Zero-shot trades some
accuracy for total label flexibility, use it for coverage of new types, then
graduate to a fine-tuned model once the schema stabilises.
Install
pip install "openmed[gliner]" # GLiNER v1 span models
pip install "openmed[gliner2]" # GLiNER2.5 checkpoints via gliner2.AutoExtractor
openmed zero deps # diagnostic: prints "GLiNER v1: ok" / "GLiNER v2: ok"
openmed zero deps only checks availability, it does not install anything.
The two-step workflow: index, then infer
GLiNER checkpoints live as local model directories. OpenMed resolves them by a
short model_id via an index.json, so you build the index once and run inference
many times.
openmed zero index <models_dir>, scan a directory of downloaded GLiNER / GLiNER2 checkpoints and writeindex.json(model ids, family, domains, paths).openmed zero infer "<text>" --model-id <id>, run extraction against a model from the index, with labels you supply.
# 1) Build the index over your local models (writes <models_dir>/index.json)
openmed zero index /models/gliner --output /models/gliner/index.json
