Agent skill

Loading Openmed Models

by maziyarpanahi in maziyarpanahi/openmed

Load OpenMed clinical/biomedical NER models from the Hugging Face Hub or a local path and reuse them efficiently across calls.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Loading Openmed Models

skills CLI
$ npx skills add maziyarpanahi/openmed --skill loading-openmed-models -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install maziyarpanahi/openmed loading-openmed-models --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/maziyarpanahi/openmed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/loading-openmed-models .claude/skills/loading-openmed-models && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
loading-openmed-models
GitHub stars
5.5k
Token cost
~2.1k tokens
SKILL.md length
678 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Load OpenMed clinical/biomedical NER models from the Hugging Face Hub or a local path and reuse them efficiently across calls.

  • Works in 2 steps: First run (online): the model is fetched… → Every run after: transformers serves…
  • The user wants to load an OpenMed model
  • SKILL.md covers When to use, Install, The three ways to name a model and Quick start: load and reuse a…, plus 8 more sections
  • Calls pip; needs HF_TOKEN

What it does

Loading Openmed Models is an agent skill from maziyarpanahi/openmed. Load OpenMed clinical/biomedical NER models from the Hugging Face Hub or a local path and reuse them efficiently across calls. Use when the user wants to load an OpenMed model, control the model cache, run fully offline after a one-time download, reuse a ModelLoader to avoid reloading, set a cachedir or device, or pick between a registry key, a full Hugging Face id, and a local directory. Pairs with choosing-openmed-models (pick the model) and extracting-clinical-entities (run it).

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Model hubs and datasets. It works with Hugging Face. The repository describes itself as: Local-first healthcare AI: clinical NER & HIPAA PII de-identification that runs 100% on-device. 2,200+ medical models, 21 languages, Apple MLX + Python, no cloud, no patient data…. The licence is Apache-2.0.

When your agent uses it

  • The user wants to load an OpenMed model
  • Control the model cache
  • Run fully offline after a one-time download
  • Reuse a ModelLoader to avoid reloading

Example prompts

  • “/loading-openmed-models”

Requirements

  • Python 3

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. First run (online): the model is fetched from the Hub into cache_dir.
  2. Every run after: transformers serves from cache with no network call.

What it can do on your machine

Read from SKILL.md and the folder at commit 6b1bb2c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • huggingface.co

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • HF_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Loading Openmed Models loads about 2.1k tokens when it runs. Until then it costs about 128 tokens; SKILL.md has 678 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~128
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from maziyarpanahi/openmed at commit 6b1bb2c, republished under its Apache-2.0 licence (© maziyarpanahi). 678 words, ~2,087 tokens.

Download SKILL.mdSave it as .claude/skills/loading-openmed-models/SKILL.md (or your agent's skills folder).
name
loading-openmed-models
description
Load OpenMed clinical/biomedical NER models from the Hugging Face Hub or a local path and reuse them efficiently across calls. Use when the user wants to load an OpenMed model, control the model cache, run fully offline after a one-time download, reuse a ModelLoader to avoid reloading, set a cache_dir or device, or pick between a registry key, a full Hugging Face id, and a local directory. Pairs with choosing-openmed-models (pick the model) and extracting-clinical-entities (run it).
license
Apache-2.0
metadata.project
OpenMed
metadata.category
openmed-core
metadata.pairs
adjacent
metadata.version
1.0

Loading OpenMed Models

OpenMed models download once from the Hugging Face Hub into a local cache, then run fully on-device — no network, no telemetry. This skill covers how to load a model, reuse it across many calls without reloading weights, point at a local copy, and run offline.

When to use

  • You are about to run NER repeatedly and want to load the model once.
  • You need to control where weights are cached (cache_dir) or force CPU/GPU.
  • You must run offline in a locked-down or air-gapped environment.
  • You are choosing between a registry key, a full HF id, or a local directory.

For which model to load, see choosing-openmed-models. To actually run it, see extracting-clinical-entities.

Install

bash
pip install "openmed[hf]"   # adds Hugging Face transformers + hub download

The three ways to name a model

analyze_text, extract_pii, load_model, and ModelLoader.load_model all accept the same model_name in three forms:

FormExampleNotes
Registry key"disease_detection_superclinical"Short, resolved via the bundled registry.
Full HF id"OpenMed/OpenMed-NER-DiseaseDetect-BigMed-278M"Anything org/name; downloaded from the Hub.
Local path"/models/my-openmed-ner"An existing directory; loaded with local_files_only=True.

A bare name without / is prefixed with the default org (OpenMed). An existing local path is detected automatically and never hits the network.

Quick start: load and reuse a loader

The single most important pattern — build one ModelLoader, pass it everywhere. The loader caches models, tokenizers, and pipelines in memory, so the second call is instant.

python
import openmed
from openmed import ModelLoader, OpenMedConfig

# One loader, reused across calls. Weights load on the first call only.
loader = ModelLoader()

notes = [
    "Patient prescribed 500 mg metformin for type 2 diabetes.",
    "History of myocardial infarction; started on atorvastatin.",
]

for note in notes:
    result = openmed.analyze_text(
        note,
        model_name="disease_detection_superclinical",
        loader=loader,          # <-- reuse; no reload on subsequent calls
        output_format="dict",
    )
    print(result.entities)

Without loader=, each analyze_text call constructs a fresh ModelLoader. The underlying Hugging Face cache still prevents re-downloads, but you pay to re-instantiate the pipeline — avoid that in loops and services.

Load weights directly

When you want the raw model/tokenizer (e.g. to inspect config or build a custom pipeline):

python
from openmed import load_model

bundle = load_model("disease_detection_superclinical")
model     = bundle["model"]
tokenizer = bundle["tokenizer"]
config    = bundle["config"]

load_model(model_name, config=None, **kwargs) is a thin convenience wrapper that builds a ModelLoader and calls loader.load_model(...). For reuse, prefer constructing the loader yourself:

python
loader = ModelLoader()
bundle = loader.load_model("disease_detection_superclinical")
# Second call returns the cached bundle (no reload):
bundle2 = loader.load_model("disease_detection_superclinical")
# Force a fresh load if you replaced files on disk:
fresh = loader.load_model("disease_detection_superclinical", force_reload=True)

Configure the cache, device, and org

OpenMedConfig is a dataclass. Pass it to ModelLoader(config=...).

python
from openmed import ModelLoader, OpenMedConfig

config = OpenMedConfig(
    cache_dir="/data/openmed-cache",   # default: ~/.cache/openmed
    device="cpu",                       # None = auto-detect
    default_org="OpenMed",              # prepended to bare model names
    hf_token=None,                      # or set env HF_TOKEN for private repos
)
loader = ModelLoader(config)

Relevant OpenMedConfig fields: cache_dir, device, default_org, hf_token, timeout (default 300s), backend (None auto / "hf" / "mlx"), log_level. hf_token falls back to the HF_TOKEN environment variable.

First-run download, then fully offline

  1. First run (online): the model is fetched from the Hub into cache_dir.
  2. Every run after: transformers serves from cache with no network call.

To guarantee no network access (air-gapped, CI, PHI environments), set the standard Hugging Face offline switch before importing:

bash
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1

Or vendor the model and pass a local path — that path is loaded with local_files_only=True and never contacts the Hub:

python
result = openmed.analyze_text(note, model_name="/models/openmed-disease-ner")

To pre-warm a cache for offline use, run one inference (or load_model) once with network access, then disable it.

Show full SKILL.md (260 more words)Show less

Check a model's maximum sequence length

Useful before chunking long documents:

python
from openmed import get_model_max_length, ModelLoader

loader = ModelLoader()
max_len = get_model_max_length("disease_detection_superclinical", loader=loader)
print(max_len)   # e.g. 512 — None if it can't be inferred

get_model_max_length(model_name, *, config=None, loader=None) delegates to loader.get_max_sequence_length(model_name). Pass the same loader you use for inference so the tokenizer is loaded only once.

Free memory when done

The loader holds models in RAM until released:

python
loader.unload_model("disease_detection_superclinical")  # drop one model
loader.unload_all_models()                               # drop everything
loader.loaded_models()                                   # inspect what's cached

Hand-off to / from OpenMed

  • From choosing-openmed-models: that skill yields a model key or HF id; feed it straight into ModelLoader.load_model(...) or as model_name=.
  • To extracting-clinical-entities: pass your reused loader= into openmed.analyze_text(...) so a long batch loads weights exactly once.
  • To de-identification: openmed.extract_pii(..., loader=loader) and openmed.deidentify(..., loader=loader) accept the same loader — share one loader across NER and PHI steps in a pipeline.
python
loader = ModelLoader(OpenMedConfig(cache_dir="/data/openmed-cache"))
phi   = openmed.deidentify(note, method="mask", loader=loader)
ner   = openmed.analyze_text(phi.deidentified_text, loader=loader)

Edge cases & gotchas

  • pip install openmed alone is not enough to download models — add the [hf] extra (or have transformers + huggingface_hub installed). ModelLoader raises ImportError with an install hint if transformers is missing.
  • Local path vs registry key collision: if a bare name happens to exist as a directory, the local path wins. Use an absolute path to be explicit.
  • force_reload=True is required after you overwrite files in a local model directory; otherwise the in-memory cache is served.
  • Private repos need hf_token (or HF_TOKEN) and HF_HUB_OFFLINE unset for the first download.
  • No PHI in the cache path or logs. Cache model weights, never patient text. cache_dir should not live inside a PHI data directory.
  • Permissive licensing only. OpenMed models are Apache-2.0. Do not stage UMLS/SNOMED/CPT/MIMIC/i2b2/n2c2 assets in the cache — those stay out-of-process under the user's own license.

Standards & references

© maziyarpanahi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/loading-openmed-models of maziyarpanahi/openmed.

Open the folder on GitHubat commit 6b1bb2c

Compare with similar skills

Loading Openmed Models next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Loading Openmed Models compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Loading Openmed Models this skillmaziyarpanahi/openmed5.5k—~2.1kAutomated safety check: PassApache-2.0
LLM Benchmarking with lm-evaluation-harnessOrchestra-Research/AI-Research-SKILLs13k8 repos~3kAutomated safety check: PassMIT
SageMaker Serving Image Selectionhuggingface/skills11k1 repos~4.6kAutomated safety check: PassApache-2.0
Hugging Face Local Model Evalshuggingface/skills11k2 repos~1.6kAutomated safety check: PassApache-2.0
Upload Post Imagehuggingface/blog3.5k—~1.1kAutomated safety check: PassNone
Add Archon Modelareal-project/AReaL5.8k—~4.9kAutomated safety check: PassApache-2.0

Similar skills

  • LLM Benchmarking with lm-evaluation-harness

    Orchestra-Research/AI-Research-SKILLs

    Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.

    13k GitHub starsUsed in 8 repos~3k tokens
    AI & LLM EngineeringAuto-check passed
  • Official

    Chooses the right serving container and current image URI for deploying a Hugging Face model to a SageMaker endpoint, preferring Hugging Face images over generic ones.

    11k GitHub starsUsed in 1 repo~4.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Official

    Runs evaluations of Hugging Face Hub models on local hardware with inspect-ai or lighteval, and helps choose between vLLM, Transformers and accelerate backends.

    11k GitHub starsUsed in 2 repos~1.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Upload Post Image

    huggingface/blog

    Official

    A skill your agent uses when adding or migrating non-thumbnail images for a Hugging Face Blog post.

    3.5k GitHub stars~1.1k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Add Archon Model

    areal-project/AReaL

    Guide for adding a new model to the Archon engine. An agent skill from areal-project/AReaL.

    5.8k GitHub stars~4.9k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Esmfold2

    JimLiu/science-skills

    Biohub ESMFold2 / ESMFold2-Fast all-atom co-folding (Candido et al.

    227 GitHub starsUsed in 4 repos~2.5k tokens
    AI & LLM EngineeringAuto-check passed

More from maziyarpanahi/openmed

All 74 skills in this repo
  • Checks OpenMed de-identified clinical text against the 18 HIPAA Safe Harbor identifier categories and reports gaps and residual re-identification risk.

    5.5k GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • OpenMed Model Card Writer

    maziyarpanahi/openmed

    Fills in a model card for an OpenMed clinical NER or de-identification model from its evaluation reports: intended use, metrics, subgroups and limitations.

    5.5k GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Walks a data pipeline against the HIPAA Privacy and Security Rule checklist and produces a gap report before it processes patient data.

    5.5k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • ICD-10 Coding Assistant

    maziyarpanahi/openmed

    Suggests candidate ICD-10-CM diagnosis and ICD-10-PCS procedure codes for clinical text extracted by OpenMed, with rationale for a certified coder to review.

    5.5k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • OpenMed ETL to OMOP CDM

    maziyarpanahi/openmed

    Maps OpenMed-extracted, terminology-coded conditions, drugs and measurements into OMOP CDM v5.4 tables for OHDSI and ATLAS analytics.

    5.5k GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed
  • Extracting SDOH and Z-Codes

    maziyarpanahi/openmed

    Finds social risks such as housing instability or food insecurity in clinical notes and proposes matching ICD-10-CM Z-codes for a coder to confirm.

    5.5k GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Loading Openmed Models

What does Loading Openmed Models do?

Load OpenMed clinical/biomedical NER models from the Hugging Face Hub or a local path and reuse them efficiently across calls. Loading Openmed Models is an agent skill from maziyarpanahi/openmed. Load OpenMed clinical/biomedical NER models from the Hugging Face Hub or a local path and reuse them efficiently across calls.

When should I use Loading Openmed Models?

Loading Openmed Models fits situations like: the user wants to load an OpenMed model; control the model cache; run fully offline after a one-time download; reuse a ModelLoader to avoid reloading.

How do I install Loading Openmed Models in Claude Code?

Run `npx skills add maziyarpanahi/openmed --skill loading-openmed-models -a claude-code`. Or copy the skill folder (skills/loading-openmed-models in maziyarpanahi/openmed) into .claude/skills/loading-openmed-models in your project. Claude Code loads it when a task matches its description.

How do I install Loading Openmed Models in Codex?

Run `npx skills add maziyarpanahi/openmed --skill loading-openmed-models -a codex`. Or copy the skill folder (skills/loading-openmed-models in maziyarpanahi/openmed) into .agents/skills/loading-openmed-models in your project. Codex loads it when a task matches its description.

Can I use Loading Openmed Models in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add maziyarpanahi/openmed --skill loading-openmed-models -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/loading-openmed-models, .gemini/skills/loading-openmed-models, .github/skills/loading-openmed-models and .opencode/skills/loading-openmed-models in your project.

What does Loading Openmed Models need to run?

Going by SKILL.md and its folder, Loading Openmed Models needs the command-line tools its instructions call (pip) and credentials named HF_TOKEN. Our summary lists: Python 3.

Does Loading Openmed Models access the network?

SKILL.md names 1 domain. As links in the text: huggingface.co. This is read from the text; nothing was executed.

Is Loading Openmed Models safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Loading Openmed Models use?

Loading Openmed Models is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Loading Openmed Models use?

About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Loading Openmed Models?

Skills that share tags, products or a category with Loading Openmed Models: LLM Benchmarking with lm-evaluation-harness (Orchestra-Research/AI-Research-SKILLs, 13k stars), SageMaker Serving Image Selection (huggingface/skills, 11k stars), Hugging Face Local Model Evals (huggingface/skills, 11k stars) and Upload Post Image (huggingface/blog, 3.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Loading Openmed Models?

maziyarpanahi (a GitHub user) maintains it in maziyarpanahi/openmed, which has 5,493 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 9, 2026.

Source: maziyarpanahi/openmed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.