Giter Club home page Giter Club logo

lhrlab / text2nkg Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 52.06 MB

Text2NKG: Fine-Grained N-ary Relation Extraction for N-ary relational Knowledge Graph Construction

Home Page: https://arxiv.org/abs/2310.05185

License: MIT License

Python 83.29% Shell 0.04% Makefile 0.04% Dockerfile 0.01% CSS 0.17% Jupyter Notebook 16.46%
hyper-relational-knowledge-graph knowledge-graph-construction relation-extraction fine-grained hypergraph information-extraction

text2nkg's Introduction

Text2NKG

Text2NKG: Fine-Grained N-ary Relation Extraction for N-ary relational Knowledge Graph Construction [paper].

Overview

Setup

Default implementation environment

  • Linux(SSH) + Python3.7.13 + Pytorch1.8.1 + Cuda11.1
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

Install Dependencies

Install dependencies, The code is based on huggaface's transformers:

pip install -r requirement.txt
pip install --editable ./transformers

Then, we should install apex.

unzip apex.zip
cd apex
python setup.py install
cd ..

Datasets

Our experiments are based on HyperRED dataset.

Download PLMs

Download Pre-trained Language Models from Hugging Face:

mkdir -p bert_models/bert-base-uncased
wget -P bert_models/bert-base-uncased https://huggingface.co/bert-base-uncased/resolve/main/pytorch_model.bin
wget -P bert_models/bert-base-uncased https://huggingface.co/bert-base-uncased/resolve/main/vocab.txt
wget -P bert_models/bert-base-uncased https://huggingface.co/bert-base-uncased/resolve/main/config.json
mkdir -p bert_models/bert-large-uncased
wget -P bert_models/bert-large-uncased https://huggingface.co/bert-large-uncased/resolve/main/pytorch_model.bin
wget -P bert_models/bert-large-uncased https://huggingface.co/bert-large-uncased/resolve/main/vocab.txt
wget -P bert_models/bert-large-uncased https://huggingface.co/bert-large-uncased/resolve/main/config.json
wget -P bert_models/bert-large-uncased https://huggingface.co/bert-large-uncased/resolve/main/tokenizer.json
wget -P bert_models/bert-large-uncased https://huggingface.co/bert-large-uncased/resolve/main/tokenizer_config.json

Training

Train Text2NKG n-ary RE Models:

python run_re.py

BibTex

If you find this work is helpful for your research, please cite:

@misc{luo2023text2nkg,
      title={Text2NKG: Fine-Grained N-ary Relation Extraction for N-ary relational Knowledge Graph Construction}, 
      author={Haoran Luo and Haihong E and Yuhao Yang and Tianyu Yao and Yikai Guo and Zichen Tang and Wentai Zhang and Kaiyang Wan and Shiyao Peng and Meina Song and Wei Lin},
      year={2023},
      eprint={2310.05185},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}

For further questions, please contact: [email protected], or wechat: lhr1846205978.

text2nkg's People

Contributors

lhrlab avatar starlight24 avatar yao12315 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kaiyangwan

text2nkg's Issues

Few Questions

  1. How do we populate a graph DB with the processed training data or the test predictions. Do you have a script for that
  2. Is it possible to infer the model over raw text, or is it necessary to convert it into the training format, any code snippet to inference will be nice as well

Thanks again for this great project and making the code public

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.