
Running Openmed Ondevice
Run OpenMed models fully on-device with the MLX (Apple Silicon), CoreML (iOS/macOS), or...
Install
npx skills add maziyarpanahi/openmed --skill running-openmed-ondevice -g -a claude-code -y- Repository
- maziyarpanahi/openmed5.8k
- Category
- DevOps
- Updated
- 4d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 1,810 tokens
- Runs scripts
- No, instructions only
What it does
Run OpenMed models fully on-device with the MLX (Apple Silicon), CoreML (iOS/macOS), or ONNX/WebGPU (cross-platform/browser) backends, including convert-quantize-run workflows. Use when the user wants to deploy OpenMed at the edge, run NER/de-id on Apple Silicon, target iPhone/iPad/Mac, export to ONNX or WebGPU, quantize a clinical model to int8/4-bit, run with no network, or pick between MLX/CoreML/ONNX. Covers the mlx/coreml/onnx extras, the convert() functions and python -m convert CLIs, quantization, loading a local MLX artifact through analyze_text, OpenMedMLXLanguageModel/generate_text, and the on-device-only PHI guarantee (nothing leaves the host).
Running OpenMed on-device
OpenMed runs fully on-device by design. These three backends let you take it further at the edge: MLX (Apple Silicon acceleration), CoreML (iOS/macOS / Neural Engine), and ONNX / WebGPU (cross-platform and in-browser). The flow is the same: convert → (quantize) → run locally. Because inference is local, raw PHI never leaves the device, the strongest privacy posture OpenMed offers.
When to use this skill
When you need OpenMed where there is no server: an iOS/macOS app (CoreML),
fast NER/de-id on an Apple Silicon Mac (MLX), or a portable/browser deployment
(ONNX/WebGPU). For a hosted endpoint use serving-openmed-rest-api; for an
agent tool use deploying-openmed-mcp; for corpora use
batch-processing-clinical-text.
Pick a backend
| Backend | Extra | Best for | Quantization |
|---|---|---|---|
| MLX | openmed[mlx] | Apple Silicon Macs; fastest local NER/de-id; on-device LLMs | 4-bit / 8-bit weights |
| CoreML | openmed[coreml] | iOS/iPadOS/macOS apps, Neural Engine | int8 palettization |
| ONNX / WebGPU | openmed[onnx] | cross-platform runtimes, browser (transformers.js) | fp16 (WebGPU); int8 via ORT |
Quick start, MLX (Apple Silicon)
pip install "openmed[mlx]"
# Convert a HF token-classification model to an OpenMed MLX artifact, 8-bit:
python -m openmed.mlx.convert --model OpenMed/<some-ner-model> --output ./mlx_ner --quantize 8
import openmed
# Run NER/de-id through the normal API, pass the local artifact dir as model_name.
# The loader auto-detects the MLX backend from the artifact (or set backend explicitly).
result = openmed.analyze_text(
"Patient received 75mg clopidogrel for NSTEMI.",
model_name="./mlx_ner", # local MLX artifact directory
output_format="dict",
)

