Skip to content

Reproduceing the models of Knowledge Representation Learning (KRL), such as TransE, TransH etc.

License

Notifications You must be signed in to change notification settings

yubinCloud/kg2vec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KRL

This is a framework that uses PyTorch to reproduce Knowledge Representation Learning (KRL) models. With it, you can easily run models of knowledge representation learning, while quickly implementing your ideas after making simple changes or extensions.

Currently, we have implemented several knowledge representation learning models including TransE, RESCAL, and simple abstraction and decoupling of publicly reusable code.

Don't use this repo because I am developing it. So it must suffer broken changes in the future.

The overview structure of this library is below:

How to use it?

Don't use it now! The document has not been updated. I will write it soon.

If you just want to use the models directly, then you just need to run the sample scripts located in the directory ./examples and all you need to do is change a few parameters that you want to change. The call to the training code has been wrapped through Typer, which is a great tool for building CLIs. So we can call the training code by CLIs. The examples can be found in the directory ./examples.

Example:

cd ./examples
sh transe.sh

If you are trying to make some changes or innovations, then you may need to briefly understand the logic of how this library works. Fortunately, the code is cleanly wrapped and decoupled, which makes it easy for you to understand the logic of the entire program and make changes to parts of it.

First, run through the transe.ipynb notebook in the project root directory and you will get to know the core logic of the library. Therefore, successfully running through this notebook is the first step to using the project. This notebook replicates the operation of the TransE model.

In this real program library, there is still a difference between the running logic of a model and the logic in a notebook. To realize the reuse of module code, the program library again abstracts and encapsulates part of the program code, but this does not change the core idea of the model operation.

  • Notice: Before you run this script, you should download the dataset, such as FB15k, and modify the script for choosing the path of the dataset and checkpoints.

The example ./transe.ipynb is a good tutorial for reproducing the TransE if you want to know the structure of this repo. This tutorial can be run without any dependencies, except for the use of common third-party libraries like PyTorch and Numpy.

Dataset

In this paper, the different types of datasets are uniformly encapsulated in the KRLDataset class. But the data in the dataset needs to be downloaded by you and the disk path to the dataset needs to be specified when generating the configuration instance.

You can download the dataset here: KGDataset.

Plan

Status Model Year Paper Rewarks
✔️ RESCAL 2011 ICML'11, OpenReview
✔️ TransE 2013 NIPS'13, ACM
✔️ TransH 2014 AAAI'14, ReasearchGate
✔️ DistMult 2014 ICLR'15, arXiv
✔️ TransR 2015 AAAI'15, AAAI a low performance, but I don't know why.
TransD 2015 ACL-IJCNLP 2015, Aclanthology
TransA 2015 arXiv
TransG 2015 arXiv
KG2E 2015 CIKM'15, ACM
TranSparse 2016 AAAI'16, AAAI
TransF 2016 AAAI'16, AAAI
ComplEx 2016 ICML'16, arXiv
HolE 2016 AAAI'16, arXiv
R-GCN 2017 ESWC'18, arXiv
ConvKB 2018 NAACL-HLT 2018, arXiv
ConvE 2018 AAAI'18, arXiv
SimplE 2018 NIPS'18, arXiv
RotatE 2019 ICLR'19, arXiv
QuatE 2019 NeurIPS'19, arXiv
ConvR 2019 NAACL-HLT 2019, Aclanthology
KG-BERT 2019 arXiv
PairRE 2021 ACL-IJCNLP 2021, Aclanthology

How to contribute it?

If you have read the code of this project, then you should have understood the code style of this library. All you need to do is to extend it as you see fit and submit pull requests after successful testing.

About

Reproduceing the models of Knowledge Representation Learning (KRL), such as TransE, TransH etc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published