🚀 GLiNER-BioMed
GLiNER-BioMed是一套高效的开放生物医学命名实体识别模型。它基于GLiNER框架,利用从大型生成式生物医学语言模型中提取的合成注释,在生物医学实体识别任务中实现了零样本和少样本的先进性能。该模型为传统命名实体识别模型和大语言模型提供了实用的替代方案。
🚀 快速开始
GLiNER-BioMed是专门用于生物医学命名实体识别的模型,下面将指导你如何快速使用它。
✨ 主要特性
- 广泛的实体识别能力:GLiNER能够识别任何实体类型,突破了传统NER模型只能识别预定义实体的限制。
- 高效性能:GLiNER-biomed基于GLiNER框架,引入了一套高效的开放生物医学NER模型,在零样本和少样本的生物医学实体识别任务中表现出色。
- 合成注释的利用:该模型利用从大型生成式生物医学语言模型中提取的合成注释,提升了模型的性能。
📦 安装指南
使用pip安装官方的GLiNER库:
pip install gliner -U
💻 使用示例
基础用法
安装GLiNER库后,你可以轻松加载GLiNER-biomed模型并执行命名实体识别:
from gliner import GLiNER
model = GLiNER.from_pretrained("Ihor/gliner-biomed-bi-base-v1.0")
text = """
The patient, a 45-year-old male, was diagnosed with type 2 diabetes mellitus and hypertension.
He was prescribed Metformin 500mg twice daily and Lisinopril 10mg once daily.
A recent lab test showed elevated HbA1c levels at 8.2%.
"""
labels = ["Disease", "Drug", "Drug dosage", "Drug frequency", "Lab test", "Lab test value", "Demographic information"]
entities = model.predict_entities(text, labels, threshold=0.5)
for entity in entities:
print(entity["text"], "=>", entity["label"])
高级用法
如果你有大量实体并希望预先嵌入它们,请参考以下代码片段:
labels = ["your entities"]
texts = ["your texts"]
entity_embeddings = model.encode_labels(labels, batch_size = 8)
outputs = model.batch_predict_with_embeds(texts, entity_embeddings, labels)
📚 详细文档
模型基准测试
我们在8个复杂的真实世界数据集上对模型进行了测试,并与其他GLiNER模型进行了比较。
加入我们的Discord社区
在Discord上与我们的社区联系,获取有关我们模型的最新消息、支持和讨论。点击Discord加入。
📄 许可证
本项目采用Apache-2.0许可证。
📚 引用信息
本工作
如果你在工作中使用了GLiNER-biomed模型,请引用以下文献:
@misc{yazdani2025glinerbiomedsuiteefficientmodels,
title={GLiNER-biomed: A Suite of Efficient Models for Open Biomedical Named Entity Recognition},
author={Anthony Yazdani and Ihor Stepanov and Douglas Teodoro},
year={2025},
eprint={2504.00676},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.00676},
}
先前工作
@misc{zaratiana2023gliner,
title={GLiNER: Generalist Model for Named Entity Recognition using Bidirectional Transformer},
author={Urchade Zaratiana and Nadi Tomeh and Pierre Holat and Thierry Charnois},
year={2023},
eprint={2311.08526},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{stepanov2024gliner,
title={GLiNER multi-task: Generalist Lightweight Model for Various Information Extraction Tasks},
author={Ihor Stepanov and Mykhailo Shtopko},
year={2024},
eprint={2406.12925},
archivePrefix={arXiv},
primaryClass={id='cs.LG' full_name='Machine Learning' is_active=True alt_name=None in_archive='cs' is_general=False description='Papers on all aspects of machine learning research (supervised, unsupervised, reinforcement learning, bandit problems, and so on) including also robustness, explanation, fairness, and methodology. cs.LG is also an appropriate primary category for applications of machine learning methods.'}
}