dgl-ke

awslabsApache-2.0更新放缓

基于 DGL 的高性能知识图谱嵌入学习库,支持在超大规模图谱上训练 TransE、RotatE 等嵌入模型,兼顾易用性与可扩展性。

High performance, easy-to-use, and scalable package for learning large-scale knowledge graph embeddings.

0.1.1发布于 2020-08-26 05:23 UTC1,336star202fork同步于 2026-11-07 07:31 UTC

怎么上手

由 README 提炼,执行前请确认
sudo pip3 install dgl
sudo pip3 install dglke
硬件要求按 README 说明

README 说明可在 CPU 机器、GPU 机器以及集群上运行,但未给出具体显存或 GPU 型号要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 DGL 的大规模知识图谱嵌入训练工具,支持 CPU、GPU 和集群

基于 DGL 的高性能知识图谱嵌入学习库,支持在超大规模图谱上训练 TransE、RotatE 等嵌入模型,兼顾易用性与可扩展性。

核心能力

  • 支持 TransE、TransR、RESCAL、DistMult、ComplEx、RotatE 等模型
  • 提供 dglke_train 单机训练与 dglke_dist_train 分布式训练
  • 用 dglke_eval 做链接预测评估,用 dglke_predict 和 dglke_emb_sim 做推理
  • 在 8600 万节点、3.38 亿边的图上验证过扩展性

容易踩的坑

训练命令需设置 DGLBACKEND=pytorch 环境变量;首次运行 dglke_train 会自动下载 FB15k 数据集;若只想用 TransE、DistMult、RotatE 训练,README 建议改用 GraphStorm。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

2 个版本0.1.1
  1. 0.1.1v0.1.1最新正式版2020-08-26 · 2020-08-26 05:23 UTC

    This patch release provides the following features.

  2. v0.1.02020-04-02 · 2020-04-02 04:35 UTC
    查看更新说明

    We are happy to announce the first release of DGL-KE, a lightning-speed package for learning knowledge graph embeddings. DGL-KE was previously incubated under the DGL repository. It is now a standalone package with more efficient and more scalable training. The key highlights are:

    • Effortlessly generate knowledge graph embedding with one line of code.
    • Support for giant graphs with millions of nodes and billions of edges for various hardware:
      • multi-CPU machines,
      • multi-GPU machines,
      • a cluster of machines.
    • Support for both Pytorch and MXNet.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    License

    Documentation

    Knowledge graphs (KGs) are data structures that store information about different entities (nodes) and their relations (edges). A common approach of using KGs in various machine learning tasks is to compute knowledge graph embeddings. DGL-KE is a high performance, easy-to-use, and scalable package for learning large-scale knowledge graph embeddings. The package is implemented on the top of Deep Graph Library (DGL) and developers can run DGL-KE on CPU machine, GPU machine, as well as clusters with a set of popular models, including TransE, TransR, RESCAL, DistMult, ComplEx, and RotatE.

    Currently DGL-KE support three tasks:

    • Training, trains KG embeddings using dglke_train(single machine) or dglke_dist_train(distributed environment).
    • Evaluation, reads the pre-trained embeddings and evaluates the embeddings with a link prediction task on the test set using dglke_eval.
    • Inference, reads the pre-trained embeddings and do the entities/relations linkage predicting inference tasks using dglke_predict or do the embedding similarity inference tasks using dglke_emb_sim.

    Note

    If you just want to train a KGE model using TransE, DistMult, RotatE, please goto https://github.com/awslabs/graphstorm.

    A Quick Start

    To install the latest version of DGL-KE run:

    sudo pip3 install dgl
    sudo pip3 install dglke
    

    Train a transE model on FB15k dataset by running the following command:

    DGLBACKEND=pytorch dglke_train --model_name TransE_l2 --dataset FB15k --batch_size 1000 \
    --neg_sample_size 200 --hidden_dim 400 --gamma 19.9 --lr 0.25 --max_step 500 --log_interval 100 \
    --batch_size_eval 16 -adv --regularization_coef 1.00E-09 --test --num_thread 1 --num_proc 8
    

    This command will download the FB15k dataset, train the transE model and save the trained embeddings into the file.

    Performance and Scalability

    DGL-KE is designed for learning at scale. It introduces various novel optimizations that accelerate training on knowledge graphs with millions of nodes and billions of edges. Our benchmark on knowledge graphs consisting of over 86M nodes and 338M edges shows that DGL-KE can compute embeddings in 100 minutes on an EC2 instance with 8 GPUs and 30 minutes on an EC2 cluster with 4 machines (48 cores/machine). These results represent a 2×∼5× speedup over the best competing approaches.

    Learn more details with our documentation! If you are interested in the optimizations in DGL-KE, please check out our paper for more details.

    Cite

    If you use DGL-KE in a scientific publication, we would appreciate citations to the following paper:

    @inproceedings{DGL-KE,
    author = {Zheng, Da and Song, Xiang and Ma, Chao and Tan, Zeyuan and Ye, Zihao and Dong, Jin and Xiong, Hao and Zhang, Zheng and Karypis, George},
    title = {DGL-KE: Training Knowledge Graph Embeddings at Scale},
    year = {2020},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    booktitle = {Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval},
    pages = {739–748},
    numpages = {10},
    series = {SIGIR '20}
    }
    

    License

    This project is licensed under the Apache-2.0 License.