running-zeroshot-ner
하는 일
이 스킬은 먼저 모델을 학습시키지 않고도 지정한 항목 집합을 텍스트에서 찾는 방법을 에이전트에게 가르칩니다. 기기나 임플란트처럼 기존 의료 모델이 다루지 않는 라벨 집합에 쓰입니다.
사용하는 경우
- ✓라벨 데이터가 없는 상태에서 의료 텍스트에서 기기 이름 같은 사용자 정의 용어 목록을 찾아야 할 때.
- ✓미세 조정 모델을 학습하기 전에 새 라벨 집합을 빠르게 시험하려고 할 때.
- ✓추출을 위해 GLiNER를 설정하거나 openmed zero 명령을 쓰는 방법을 물을 때.
스킬 링크
https://github.com/maziyarpanahi/openmed/blob/master/skills/running-zeroshot-ner/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“임플란트와 기기 이름이 학습된 모델이 없는데도 제 임상 노트에서 모두 찾아 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 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
자주 묻는 질문
제로샷이 학습된 모델만큼 정확한가요?
스킬은 라벨 유연성을 위해 어느 정도 정확도를 희생한다고 설명합니다. 흔한 유형에는 보통 학습된 모델이 더 낫습니다.
모델은 어떻게 설치하나요?
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
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
annotating-variants
5.8k에이전트가 유전 변이의 효과를 예측하고, HGVS 이름을 게놈 위치로 바꾸고, 무료 공개 주석 도구를 사용해 인구 빈도를 붙이도록 돕습니다.
ask-openmed
5.8k에이전트가 임상 텍스트 요청에 맞는 OpenMed 워크플로를 고르도록 돕되, 환자 데이터가 있을 수 있으면 먼저 개인 정보 확인을 거치게 합니다.
assembling-fhir-bundles
5.8k여러 FHIR 건강 기록을 EHR로 보낼 수 있도록 하나의 트랜잭션 Bundle로 묶고, 내부 참조를 올바르게 연결하도록 에이전트를 돕습니다.
auditing-deid-leakage
5.8k비식별화된 임상 텍스트에 남은 SSN, 카드 번호, 이메일, 날짜 같은 식별자를 검사하고, 남은 것이 있으면 공개를 막도록 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.