Update README.md
Browse files
README.md
CHANGED
|
@@ -1,50 +1,52 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
tags:
|
| 4 |
-
- ner
|
| 5 |
-
- medical
|
| 6 |
-
- chinese
|
| 7 |
-
- pytorch
|
| 8 |
-
- crf
|
| 9 |
-
language: zh
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
-
|
| 24 |
-
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
-
|
| 30 |
-
-
|
| 31 |
-
-
|
| 32 |
-
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
model.
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- ner
|
| 5 |
+
- medical
|
| 6 |
+
- chinese
|
| 7 |
+
- pytorch
|
| 8 |
+
- crf
|
| 9 |
+
language: zh
|
| 10 |
+
pretrained_model: trueto/medbert-base-chinese
|
| 11 |
+
use_bilstm: true
|
| 12 |
+
use_attention: false
|
| 13 |
+
model-index:
|
| 14 |
+
- name: MedBERT-BiLSTM-CRF (中文医疗实体识别模型)
|
| 15 |
+
results: []
|
| 16 |
+
---
|
| 17 |
+
# 中文医疗实体识别模型:MedBERT-BiLSTM-CRF
|
| 18 |
+
|
| 19 |
+
本模型基于 [trueto/medbert-base-chinese](https://huggingface.co/trueto/medbert-base-chinese) 预训练模型,结合 BiLSTM 和 CRF 构建而成,用于中文医疗命名实体识别(NER)任务。
|
| 20 |
+
|
| 21 |
+
## 🧠 模型结构
|
| 22 |
+
|
| 23 |
+
- 编码器:MedBERT
|
| 24 |
+
- 上下文建模:BiLSTM(双向 LSTM)
|
| 25 |
+
- 序列解码:CRF(条件随机场)
|
| 26 |
+
- 标签体系:BIO(13类)
|
| 27 |
+
|
| 28 |
+
支持的实体类别包括:
|
| 29 |
+
- Anatomical(解剖结构)
|
| 30 |
+
- Diseases(疾病)
|
| 31 |
+
- Drug(药品)
|
| 32 |
+
- Image(影像检查)
|
| 33 |
+
- Laboratory(实验室指标)
|
| 34 |
+
- Operation(手术操作)
|
| 35 |
+
|
| 36 |
+
## 📦 使用说明(PyTorch)
|
| 37 |
+
|
| 38 |
+
由于本模型为自定义结构(非 transformers 原生模型),请使用本项目中的结构类 `BertCRF` 进行加载:
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from bert_crf_model import BertCRF
|
| 42 |
+
import torch
|
| 43 |
+
|
| 44 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 45 |
+
|
| 46 |
+
model = BertCRF(
|
| 47 |
+
bert_model_name="trueto/medbert-base-chinese",
|
| 48 |
+
num_labels=13
|
| 49 |
+
)
|
| 50 |
+
model.load_state_dict(torch.load("pytorch_model.bin", map_location=device))
|
| 51 |
+
model.to(device)
|
| 52 |
+
model.eval()
|