UniKE — 知识图谱嵌入工具包
基于 OpenKE-PyTorch 开发的知识图谱嵌入工具包,支持跨平台运行,具备自动超参数搜索、高效并行训练以及实验结果记录功能,为研究与应用提供强大助力。
教程和 API 参考文档可以访问 unike.readthedocs.io。
项目结构
- 📁
unike/
UniKE 源代码保存在unike/ - 📚
docs/
所有的文档源文件保存在docs/,所有的*.rst构成了文档中的各个部分 - 🌰
examples/
UniKE 的例子保存在examples/,修改自OpenKE-PyTorch - 📍
docs/_static/logs/
UniKE 的例子运行日志保存在docs/_static/logs/ - 💡
benchmarks/
常用的知识图谱保存在benchmarks/ - 📜
README.rst
项目主页
⁉️ Questions / comments
如果你有任何问题,可以在 Github issue 提问。
快速开始
使用 pip
pip install unike
新特性
易用的
- 1.0.0 版本: 利用 C++ 重写底层数据处理、C++11 的线程库实现并行、pybind11 实现 Python 和 C++ 的交互,进而能够做到跨平台 (Windows, Linux)
- 2.0.0 版本: 使用 Python 重写底层数据处理,进而能够做到跨平台 (Windows, Linux)
- 增加了文档
正确的
- 增加了
R-GCN模型 - 增加了
CompGCN模型 - 修复了 SimplE模型实现的问题
- 修复了 HolE 深度学习框架(pytorch)的版本适配问题
高效的
- 使用
torch.nn.parallel.DistributedDataParallel完成数据并行(2.0.0 版本 使用 accelerate 实现),使得UniKE能够利用多个GPU同时训练 - 增加超参数扫描功能(随机搜索、网格搜索和贝叶斯搜索)
扩展的
- 在模型训练过程中,能够在验证集上评估模型(模型能够一次评估多个三元组(batch),能够大大加速模型评估)
- 增加了学习率调度器
- 能够利用 wandb 输出日志
- 实现了早停止
- 能够自定义 Hits@N
支持的知识图谱嵌入模型
| 类型 | 模型 |
|---|---|
| 平移模型 | TransE, TransH, TransR, TransD, RotatE |
| 语义匹配模型 | RESCAL, DistMult, HolE, ComplEx, Analogy, SimplE, ANALOGY |
| 图神经网络模型 | R-GCN, CompGCN |
如何引用这个项目?
如果您发现 UniKE 对您的研究有用,请考虑使用以下 BibTeX 模板引用 UniKE:
@misc{UniKE,
author = {Lu, Yanfeng and Hou, Fengzhen},
year = {2024},
note = {https://github.com/CPU-DS/UniKE},
title = {UniKE: An Open Source Library for Knowledge Graph Embeddings}
}
该仓库主要由 Yanfeng Lu,Fengzhen Hou 提供(按时间顺序排列)。
Metadata
Release files for unike 3.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unike-3.4.0.tar.gz | 130.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unike-3.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 236.7 kB
Release files / unike-3.4.0.tar.gz
| Download URL | unike-3.4.0.tar.gz |
|---|---|
| Size | 130.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
164ba4d652e81011d1eb7a93f64cf096108b8cb209c03e9d0d53171f81ca2858
|
|
BLAKE2b-256 checksum How to use checksums |
838bd43a0b60131de7b85799ca86559aed5a2470f79bb0cf2fbcdd89c47d6f79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / unike-3.4.0-py3-none-any.whl
| Download URL | unike-3.4.0-py3-none-any.whl |
|---|---|
| Size | 105.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cae04ee965bfdb9e87dc7b5a45ff8c87d52b1bb6255dead3e97fa7fea48d729
|
|
BLAKE2b-256 checksum How to use checksums |
a117edeb0853f7fdf3258ca0cdb4235b706fff833ce467797fa63bdef0df3af3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|