supply-chain-bert
基于 bert-base-chinese 微调的中文供应链关系分类模型(PaddlePaddle)。
给定两个行业/产品实体,判断其供应链关系:上游 / 下游 / 其他。
模型信息
| 属性 | 值 |
|---|---|
| 基础模型 | bert-base-chinese |
| 框架 | PaddlePaddle |
| 分类头 | Linear(768 → 3) + Dropout(0.1) |
| 训练集规模 | ~513,000 条三元组 |
| 最大序列长度 | 128 |
输入格式
[CLS]{entity1}[SEP]{entity2}[SEP]
快速使用
pip install paddlepaddle paddlenlp
import paddle
from paddlenlp.transformers import BertModel, BertTokenizer
from huggingface_hub import hf_hub_download
LABEL_MAP = {"下游": 0, "其他": 1, "上游": 2}
ID_TO_LABEL = {v: k for k, v in LABEL_MAP.items()}
# 下载模型权重
model_path = hf_hub_download("wuhongfei/supply-chain-bert", "best_model.pdparams")
# 加载模型
tokenizer = BertTokenizer.from_pretrained("bert-base-chinese")
bert = BertModel.from_pretrained("bert-base-chinese")
# 推理
entity1, entity2 = "钢铁冶炼", "汽车制造"
text = f"[CLS]{entity1}[SEP]{entity2}[SEP]"
encoded = tokenizer(text, max_length=128, padding="max_length", truncation=True)
input_ids = paddle.to_tensor([encoded["input_ids"]], dtype="int64")
token_type_ids = paddle.to_tensor([encoded["token_type_ids"]], dtype="int64")
或直接使用仓库推理脚本:
git clone https://github.com/wuhongfei/supply-chain-bert
cd supply-chain-bert
python infer.py --model best_model.pdparams --entity1 钢铁冶炼 --entity2 汽车制造
训练配置
| 超参数 | 值 |
|---|---|
| 学习率 | 3e-5 |
| Batch Size | 32 |
| Epochs | 20 |
| Weight Decay | 0.01 |
| Warmup Proportion | 0.1 |
| 优化器 | AdamW |
关联资源
- 代码:github.com/wuhongfei/supply-chain-bert
- 数据集:huggingface.co/datasets/wuhongfei/supply-chain-triplets
License
MIT
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
Model tree for flipped121364/supply-chain-bert
Base model
google-bert/bert-base-chinese