🚀 中文醫學名稱識別模型
本模型是一個基於 bert-base-chinese
微調的模型,用於醫學名稱識別。通過在包含 10 萬多篇權威醫學文章的 5 億規模數據集上進行微調,並對數據集中所有醫學名稱進行標註,該模型在測試集上達到了 92% 的準確率。
🚀 快速開始
本模型是 bert-base-chinese
的微調版本,用於醫學名稱識別。我們在包含 10 萬多篇授權醫學文章的 5 億規模數據集上對 bert-base-chinese
進行了微調,並標註了所有醫學名稱。該模型在我們的測試數據集上達到了 92% 的準確率。
✨ 主要特性
- 基於
bert-base-chinese
進行微調,適用於醫學名稱識別任務。
- 在大規模醫學文章數據集上訓練,標註了所有醫學名稱。
- 在測試數據集上達到 92% 的準確率。
💻 使用示例
基礎用法
>>> from transformers import (AutoModelForTokenClassification, AutoTokenizer)
>>> from transformers import pipeline
>>> hub_model_id = "9pinus/macbert-base-chinese-medicine-recognition"
>>> model = AutoModelForTokenClassification.from_pretrained(hub_model_id)
>>> tokenizer = AutoTokenizer.from_pretrained(hub_model_id)
>>> classifier = pipeline('ner', model=model, tokenizer=tokenizer)
>>> result = classifier("如果病情較重,可適當口服甲硝唑片、環酯紅黴素片、吲哚美辛片等藥物進行抗感染鎮痛。")
>>> for item in result:
>>> if item['entity'] == 1 or item['entity'] == 2:
>>> print(item)
{'entity': 1, 'score': 0.99999595, 'index': 13, 'word': '甲', 'start': 12, 'end': 13}
{'entity': 2, 'score': 0.9999957, 'index': 14, 'word': '硝', 'start': 13, 'end': 14}
{'entity': 2, 'score': 0.99999166, 'index': 15, 'word': '唑', 'start': 14, 'end': 15}
{'entity': 2, 'score': 0.99898833, 'index': 16, 'word': '片', 'start': 15, 'end': 16}
{'entity': 1, 'score': 0.9999864, 'index': 18, 'word': '環', 'start': 17, 'end': 18}
{'entity': 2, 'score': 0.99999404, 'index': 19, 'word': '酯', 'start': 18, 'end': 19}
{'entity': 2, 'score': 0.99999475, 'index': 20, 'word': '紅', 'start': 19, 'end': 20}
{'entity': 2, 'score': 0.9999964, 'index': 21, 'word': '黴', 'start': 20, 'end': 21}
{'entity': 2, 'score': 0.9999951, 'index': 22, 'word': '素', 'start': 21, 'end': 22}
{'entity': 2, 'score': 0.9990088, 'index': 23, 'word': '片', 'start': 22, 'end': 23}
{'entity': 1, 'score': 0.9999975, 'index': 25, 'word': '吲', 'start': 24, 'end': 25}
{'entity': 2, 'score': 0.9999957, 'index': 26, 'word': '哚', 'start': 25, 'end': 26}
{'entity': 2, 'score': 0.9999945, 'index': 27, 'word': '美', 'start': 26, 'end': 27}
{'entity': 2, 'score': 0.9999933, 'index': 28, 'word': '辛', 'start': 27, 'end': 28}
{'entity': 2, 'score': 0.99949837, 'index': 29, 'word': '片', 'start': 28, 'end': 29}
📚 詳細文檔
訓練和評估數據
框架版本
- Transformers 4.15.0
- Pytorch 1.10.1+cu113
- Datasets 1.17.0
- Tokenizers 0.10.3
📄 許可證
本模型採用 Apache-2.0 許可證。