百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
K

kg-bert

> 编程语言
开源

KG-BERT: 知识图谱完成的 BERT

796 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

KG-BERT: 知识图谱完成的 BERT

KG-BERT: 适用于知识图谱完成的 BERT

存储库是从 pytorch-pretrained-BERT 修改而来,并在 Python 3.5+ 版本上进行了测试。

安装要求包

bash
pip install -r requirements.txt

数据

(1) 基准知识图谱数据集位于 ./data 目录下。 (2) 每个数据集中的 entity2text.txt 或 entity2textlong.txt 文件中包含实体文本序列。 (3) 每个数据集中的 relation2text.txt 文件包含关系文本序列。

重现结果

1. 三重分类

WN11

bash
python run_bert_triple_classifier.py --task_name kg --do_train  --do_eval --do_predict --data_dir ./data/WN11 --bert_model bert-base-uncased --max_seq_length 20 --train_batch_size 32 --learning_rate 5e-5 --num_train_epochs 3.0 --output_dir ./output_WN11/  --gradient_accumulation_steps 1 --eval_batch_size 512

FB13

bash
python run_bert_triple_classifier.py --task_name kg  --do_train  --do_eval --do_predict --data_dir ./data/FB13 --bert_model bert-base-cased --max_seq_length 200 --train_batch_size 32 --learning_rate 5e-5 --num_train_epochs 3.0 --output_dir ./output_FB13/  --gradient_accumulation_steps 1 --eval_batch_size 512

2. 关系预测

FB15K

bash
python3 run_bert_relation_prediction.py --task_name kg  --do_train  --do_eval --do_predict --data_dir ./data/FB15K --bert_model bert-base-cased --max_seq_length 25 --train_batch_size 32 --learning_rate 5e-5 --num_train_epochs 20.0 --output_dir ./output_FB15K/  --gradient_accumulation_steps 1 --eval_batch_size 512

3. 链接预测

WN18RR

bash
python3 run_bert_link_prediction.py --task_name kg  --do_train  --do_eval --do_predict --data_dir ./data/WN18RR--bert_model bert-base-cased --max_seq_length 50 --train_batch_size 32 --learning_rate 5e-5 --num_train_epochs 5.0 --output_dir ./output_WN18RR/  --gradient_accumulation_steps 1 --eval_batch_size 5000

UMLS

python3 run_bert_link_prediction.py --task_name kg --do_train --do_eval --do_predict --data_dir ./data/umls --bert_model bert-base-uncased --max_seq_length 15 --train_batch_size 32 --learning_rate 5e-5 --num_tr

Issues· 26 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonbertknowledge-graph

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言