Token Classification
Transformers
PyTorch
Chinese
named-entity-recognition
ner
ernie
crf
chinese-nlp
person-name-extraction
financial-documents
Instructions to use warfbro/Human-Name-extraction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use warfbro/Human-Name-extraction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="warfbro/Human-Name-extraction")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("warfbro/Human-Name-extraction", dtype="auto") - Notebooks
- Google Colab
- Kaggle
人名提取 — Human Name Extraction
基于 ERNIE 3.0 + CRF 的中文金融批复人名提取工具。双模型集成架构,差异自动交 LLM 裁定。
模型说明
- 底模:ERNIE 3.0 Base (Chinese),118M 参数
- 架构:ERNIE 编码器 → Linear(768→3) → CRF (BIO 标注)
- 任务:从金融监管批复标题中提取人名(B-PER / I-PER)
- 训练数据:2,530 条正例 + 1,000 条对抗负例(地名/公司名误识别)
双模型
| 权重文件 | 说明 |
|---|---|
finetune_best.pt |
全参数微调(ERNIE 不冻结) |
frozen_best.pt |
冻结 ERNIE + 对抗训练 |
快速开始
pip install torch>=2.4.0 "transformers==4.46.0" pytorch-crf openpyxl pandas "numpy<2"
# 单模型提取
python extract.py input.xlsx output.xlsx
# 双模型集成(差异交 LLM 裁定)
python ensemble_extract.py input.xlsx output.xlsx
输入格式
xlsx:A 列(标题),L 列(机构名等需在标题中删除的内容)
输出
| 列 | 内容 |
|---|---|
| A列 | 原始标题 |
| B列 | 提取人名(、分隔) |
| C列 | 方法(一致/LLM裁定) |
| D列 | 姓名字数 |
流水线
标题 → L列机构名剔除 → 模型推理 → 去等N人 → 英文括号扩展 → 存在性校验 → 输出
LLM 配置(集成裁定用)
项目根目录 llm 文件,OpenAI 兼容格式:
api_key=sk-xxxxxxxx
api_url=https://api.deepseek.com/chat/completions
model=deepseek-chat
文件结构
├── config.py # 全局配置
├── model.py # 模型定义 (ErnieCRF)
├── extract.py # 单模型提取入口
├── ensemble_extract.py # 双模型集成提取
├── llm_resolver.py # LLM API 调用
├── rule.py # 规则提取(备选)
├── finetune_best.pt # 模型A 权重
├── frozen_best.pt # 模型B 权重
├── llm # LLM 配置模板
└── README.md # 本文件
Model tree for warfbro/Human-Name-extraction
Base model
nghuyong/ernie-3.0-base-zh