Instructions to use kormilitzin/en_core_med7_trf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use kormilitzin/en_core_med7_trf with spaCy:
!pip install https://huggingface.co/kormilitzin/en_core_med7_trf/resolve/main/en_core_med7_trf-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("en_core_med7_trf") # Importing as module. import en_core_med7_trf nlp = en_core_med7_trf.load() - Transformers
How to use kormilitzin/en_core_med7_trf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="kormilitzin/en_core_med7_trf")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("kormilitzin/en_core_med7_trf", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Installation
pip install -U pip setuptools wheel
pip install "en-core-med7-trf @ https://huggingface.co/kormilitzin/en_core_med7_trf/resolve/main/en_core_med7_trf-1.1.0-py3-none-any.whl"
en_core_med7_trf
en_core_med7_trf is a transformer-based spaCy pipeline for medication-related named entity recognition in English clinical text.
The model extracts the following entity types:
DRUGSTRENGTHDOSAGEDURATIONFREQUENCYFORMROUTE
Version
Current release: 1.1.0
This release was retrained and repackaged for the modern spaCy/transformers stack:
- Python
3.12.13 - spaCy
3.8.14 - spacy-transformers
1.4.0 - transformers
4.53.2 - tokenizers
0.21.4 - torch
2.6.0+cu118
This version replaces the previous 1.0.0 wheel, which depended on an older spacy-transformers stack and could trigger installation problems on Python 3.12.
Citation
If you use this model, please cite the original Med7 paper:
Kormilitzin, A., Vaci, N., Liu, Q., & Nevado-Holgado, A. (2021). Med7: A transferable clinical natural language processing model for electronic health records. Artificial Intelligence in Medicine, 118, 102086. https://doi.org/10.1016/j.artmed.2021.102086
BibTeX:
@article{kormilitzin2021med7,
title = {Med7: A transferable clinical natural language processing model for electronic health records},
author = {Kormilitzin, Andrey and Vaci, Nemanja and Liu, Qiang and Nevado-Holgado, Alejo},
journal = {Artificial Intelligence in Medicine},
volume = {118},
pages = {102086},
year = {2021},
doi = {10.1016/j.artmed.2021.102086},
publisher = {Elsevier}
}
- Downloads last month
- 655
Spaces using kormilitzin/en_core_med7_trf 3
Evaluation results
- NER F1 on Med7 held-out evaluation splitself-reported0.901
- NER precision on Med7 held-out evaluation splitself-reported0.880
- NER recall on Med7 held-out evaluation splitself-reported0.924