running-zeroshot-ner
यह क्या करती है
यह स्किल एजेंट को सिखाती है कि पहले मॉडल प्रशिक्षित किए बिना टेक्स्ट में किसी भी नामित वस्तु-समूह को कैसे खोजें। यह उन लेबल-सेट के लिए है जिन्हें कोई मौजूदा मेडिकल मॉडल कवर नहीं करता, जैसे उपकरण या इम्प्लांट।
कब इस्तेमाल करें
- ✓जब उपयोगकर्ता को बिना लेबल वाले डेटा के मेडिकल टेक्स्ट में उपकरण के नाम जैसे अपने चुने हुए शब्दों की सूची खोजनी हो।
- ✓जब कोई प्रोजेक्ट फ़ाइन-ट्यून्ड मॉडल प्रशिक्षित करने से पहले नए लेबल-सेट का त्वरित परीक्षण चाहता हो।
- ✓जब उपयोगकर्ता पूछे कि निष्कर्षण के लिए GLiNER या openmed zero कमांड कैसे सेट करें।
Skill का लिंक
https://github.com/maziyarpanahi/openmed/blob/master/skills/running-zeroshot-ner/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप मेरे क्लिनिक नोट्स में सभी इम्प्लांट और उपकरणों के नाम खोज सकते हैं, भले ही इनके लिए कोई मॉडल प्रशिक्षित न हो?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट GLiNER मॉडल से एक स्थानीय इंडेक्स बनाता है और उसे उपयोगकर्ता द्वारा दिए गए लेबल के साथ चलाता है। लेबल किसी भी समय बदले जा सकते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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
# 2) Run zero-shot NER with your OWN labels (comma-separated)
openmed zero infer "Patient on insulin glargine via an insulin pump for type 1 diabetes." \
--model-id gliner-biomedical \
--labels "Drug,Device,Disease" \
--threshold 0.5 \
--index-path /models/gliner/index.json
Output is JSON: each entity has text, start, end, label, and score.
CLI flags:
zero infer: positionaltext;--model-id/-m(required, an id from the index),--labels/-l(comma-separated custom labels),--domain/-d(label preset hint),--threshold/-c(default0.5),--index-path/-i.zero index: positionalmodels_dir;--output/-o,--pretty/--compact.
If you omit --labels, OpenMed falls back to the --domain defaults (or generic
defaults). Passing explicit --labels is what makes it truly zero-shot.
Python API
The same flow in code via openmed.ner:
from openmed.ner import infer, NerRequest
request = NerRequest(
model_id="gliner-biomedical", # id from your index.json
text="Started on insulin glargine via an insulin pump for type 1 diabetes.",
labels=["Drug", "Device", "Disease"], # your custom labels — no fine-tuning
threshold=0.5,
)
response = infer(request, index_path="/models/gliner/index.json")
for ent in response.entities:
print(f"{ent.label:8} {ent.text!r:30} {ent.score:.2f} [{ent.start}:{ent.end}]")
NerRequest fields: model_id, text, labels (None ⇒ domain/default labels),
domain, threshold. infer(...) returns a NerResponse whose .entities are
Entity objects with .text, .start, .end, .label, .score.
Build / load the index from Python too:
from openmed.ner import build_index, write_index, load_index, is_gliner_available
if is_gliner_available():
index = build_index("/models/gliner")
write_index(index, "/models/gliner/index.json")
index = load_index("/models/gliner/index.json")
Helpful label utilities:
from openmed.ner import get_default_labels, available_domains
available_domains() # domains with built-in label presets
get_default_labels("clinical") # default labels for a domain hint
Writing good labels
Zero-shot quality hinges on label phrasing. Prefer natural, specific noun phrases:
- Good:
["Drug", "Medical Device", "Disease", "Symptom", "Procedure"] - Weak:
["X", "thing", "misc"]
Tune threshold to trade recall for precision. Start at 0.5 and raise it if you
see spurious spans.
Hand-off to / from Ope
अक्सर पूछे जाने वाले सवाल
क्या zero-shot उतना सटीक है जितना प्रशिक्षित मॉडल?
स्किल कहती है कि यह लेबल की लचीलापन के बदले कुछ सटीकता छोड़ता है, इसलिए आम प्रकारों के लिए प्रशिक्षित मॉडल आमतौर पर बेहतर है।
मॉडल कैसे इंस्टॉल होते हैं?
स्किल कहती है कि gliner एक्स्ट्रा इंस्टॉल करें। openmed zero deps कमांड केवल जाँचता है कि क्या उपलब्ध है।
क्या इसके लिए लेबल वाले उदाहरण चाहिए?
नहीं। स्किल कहती है कि किसी प्रशिक्षण या लेबल वाले डेटा की ज़रूरत नहीं।
जानकारी
लेखक का मूल विवरण
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.
repo: maziyarpanahi/openmed
लोकप्रियता
- GitHub स्टार
- 5.8k
- रैंकिंग में स्थान
- #14729
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
annotating-variants
5.8kआपके एजेंट को मुफ़्त सार्वजनिक एनोटेटर से जेनेटिक वेरिएंट का असर बताने, HGVS नामों को जीनोम पोज़िशन में बदलने और जनसंख्या आवृत्ति जोड़ने में मदद करती है।
ask-openmed
5.8kआपके एजेंट को क्लिनिकल टेक्स्ट अनुरोध के लिए सही OpenMed वर्कफ़्लो चुनने में मदद करती है, जहाँ मरीज़ का डेटा हो सकता है वहाँ पहले गोपनीयता जाँच से शुरू करके।
assembling-fhir-bundles
5.8kकई FHIR स्वास्थ्य रिकॉर्ड को एक ट्रांज़ैक्शन Bundle में पैक करती है, जो EHR को भेजने के लिए तैयार हो और आंतरिक संदर्भ सही जुड़े हों।
auditing-deid-leakage
5.8kडी-आइडेंटिफ़ाइड क्लिनिकल टेक्स्ट में बचे पहचानकर्ता जैसे SSN, कार्ड नंबर, ईमेल और तारीखें खोजती है, और कुछ बचा हो तो रिलीज़ रोक देती है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।