🚀 生物实体命名实体识别模型sd-ner
本模型是一个基于RoBERTa架构的模型,用于对生物实体进行命名实体识别。它能够识别生命科学领域英文文本中的多种生物实体,为生物信息的处理和分析提供了有力支持。
🚀 快速开始
模型描述
本模型基于 RoBERTa基础模型,使用 BioLang数据集 中的英文生命科学文本示例,通过掩码语言建模任务进行进一步训练。随后,在SourceData的 sd-nlp 数据集上,使用 NER
配置进行了词元分类的微调,以实现生物实体的命名实体识别。
预期用途和局限性
使用方法
该模型旨在对SourceData注释(https://sourcedata.embo.org)中使用的生物实体进行命名实体识别,包括小分子、基因产物(基因和蛋白质)、亚细胞成分、细胞系和细胞类型、器官和组织、物种以及实验方法。
要快速测试该模型,可以使用以下代码:
from transformers import pipeline, RobertaTokenizerFast, RobertaForTokenClassification
example = """<s> F. Western blot of input and eluates of Upf1 domains purification in a Nmd4-HA strain. The band with the # might corresponds to a dimer of Upf1-CH, bands marked with a star correspond to residual signal with the anti-HA antibodies (Nmd4). Fragments in the eluate have a smaller size because the protein A part of the tag was removed by digestion with the TEV protease. G6PDH served as a loading control in the input samples </s>"""
tokenizer = RobertaTokenizerFast.from_pretrained('roberta-base', max_len=512)
model = RobertaForTokenClassification.from_pretrained('EMBO/sd-ner')
ner = pipeline('ner', model, tokenizer=tokenizer)
res = ner(example)
for r in res:
print(r['word'], r['entity'])
局限性和偏差
该模型必须与 roberta-base
分词器一起使用。
📦 安装指南
文档未提及安装相关内容,可参考 transformers
库的安装方法进行安装。
📚 详细文档
训练数据
该模型使用 EMBO/sd-nlp数据集 进行词元分类训练,该数据集包含手动注释的示例。
训练过程
训练在配备4个NVIDIA Tesla V100 GPU的NVIDIA DGX Station上进行。
训练代码可在 https://github.com/source-data/soda-roberta 找到。
属性 |
详情 |
微调模型 |
EMBO/bio-lm |
分词器词汇量 |
50265 |
训练数据 |
EMBO/sd-nlp |
数据集配置 |
NER |
训练样本数 |
48771 |
评估样本数 |
13801 |
训练特征 |
O, I-SMALL_MOLECULE, B-SMALL_MOLECULE, I-GENEPROD, B-GENEPROD, I-SUBCELLULAR, B-SUBCELLULAR, I-CELL, B-CELL, I-TISSUE, B-TISSUE, I-ORGANISM, B-ORGANISM, I-EXP_ASSAY, B-EXP_ASSAY |
训练轮数 |
0.6 |
per_device_train_batch_size |
16 |
per_device_eval_batch_size |
16 |
learning_rate |
0.0001 |
weight_decay |
0.0 |
adam_beta1 |
0.9 |
adam_beta2 |
0.999 |
adam_epsilon |
1e-08 |
max_grad_norm |
1.0 |
评估结果
使用 sklearn.metrics
在7178个测试集示例上进行测试:
precision recall f1-score support
CELL 0.69 0.81 0.74 5245
EXP_ASSAY 0.56 0.57 0.56 10067
GENEPROD 0.77 0.89 0.82 23587
ORGANISM 0.72 0.82 0.77 3623
SMALL_MOLECULE 0.70 0.80 0.75 6187
SUBCELLULAR 0.65 0.72 0.69 3700
TISSUE 0.62 0.73 0.67 3207
micro avg 0.70 0.79 0.74 55616
macro avg 0.67 0.77 0.72 55616
weighted avg 0.70 0.79 0.74 55616
{'test_loss': 0.1830928772687912, 'test_accuracy_score': 0.9334821000160841, 'test_precision': 0.6987463009514112, 'test_recall': 0.789682825086306, 'test_f1': 0.7414366506288511, 'test_runtime': 61.0547, 'test_samples_per_second': 117.567, 'test_steps_per_second': 1.851}
📄 许可证
本模型使用的许可证为AGPL-3.0。