Git Product home page Git Product logo

gp-gnn's Introduction

Graph Neural Networks with Generated Parameters for Relation Extraction

Code and dataset of ACL2019 Paper Graph Neural Networks with Generated Parameters for Relation Extraction. paper

Citation

Please cite our paper if you find it helpful.

@inproceedings{zhu2019graph,
  title={Graph Neural Networks with Generated Parameters for Relation Extraction},
  author={Zhu, Hao and Lin, Yankai and Liu, Zhiyuan and Fu, Jie and Chua, Tat-Seng and Sun, Maosong},
  booktitle={Proceedings of ACL},
  year={2019}
}

This repository is mainly contributed by Hao Zhu, Chaojun Xiao. And this repository is developed based on ContextAware.

Dataset

Please download gpgnn_data.zip from Aliyun and unzip it as the data folder:

unzip gpgnn_data.zip

Requirements and Installation

This repository has been tested with Python 3.6,torch==1.4.0,sacred==0.8.1

pip3 install -r requirements.txt

Get Started

Directory structure

models/: Baseline models (LSTM, CNN, PCNN, ContextAware) in baselines.py and GPGNN model in our_models.py.

parsing/: APIs to convert graphs into tensors which can be fed into our models.

semanticgraph/: APIs to construct relation graphs from sentences.

utils/: APIs to load word embeddings, evaluate, and operate the graphs.

result/: Storage area for models and output results on the test set.

model_param.json: Hyper parameters for the GPGNN model.

Running

train:

The parameters of the function main are set in function main_config. You can modify the parameters in main_config to train different models. And the hyper parameters for the models are stored in model_params.json.

python3 train.py

test:

Before testing, you should choose proper version of the model by modifing the load_model in main_config.

python3 test.py

evaluate:

cd result
python3 test_accuracy.py --input (result_file_path)

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.