Code Monkey home page Code Monkey logo

graph2seq's Introduction

Graph2Seq

Graph2Seq is a simple code for building a graph-encoder and sequence-decoder for NLP and other AI/ML/DL tasks.

How To Run The Codes

To train your graph-to-sequence model, you need:

(1) Prepare your train/dev/test data which the form of:

each line is a json object whose keys are "seq", "g_ids", "g_id_features", "g_adj":
"seq" is a text which is supposed to be the output of the decoder
"g_ids" is a mapping from the node ID to its ID in the graph
"g_id_features" is a mapping from the node ID to its text features
"g_adj" is a mapping from the node ID to its adjacent nodes (represented as thier IDs)

See data/no_cycle/train.data as examples.

(2) Modify some hyper-parameters according to your task in the main/configure.py

(3) train the model by running the following code "python run_model.py train -sample_size_per_layer=xxx -sample_layer_size=yyy" The model that performs the best on the dev data will be saved in the dir "saved_model"

(4) test the model by running the following code "python run_model.py test -sample_size_per_layer=xxx -sample_layer_size=yyy" The prediction result will be saved in saved_model/prediction.txt

How To Cite The Codes

Please cite our work if you like or are using our codes for your projects!

Kun Xu, Lingfei Wu, Zhiguo Wang, Yansong Feng, Michael Witbrock, and Vadim Sheinin (first and second authors contributed equally), "Graph2Seq: Graph to Sequence Learning with Attention-based Neural Networks", arXiv preprint arXiv:1804.00823.

@article{xu2018graph2seq,
title={Graph2Seq: Graph to Sequence Learning with Attention-based Neural Networks},
author={Xu, Kun and Wu, Lingfei and Wang, Zhiguo and Feng, Yansong and Witbrock, Michael and Sheinin, Vadim},
journal={arXiv preprint arXiv:1804.00823},
year={2018}
}


Contributors: Kun Xu, Lingfei Wu
Created date: November 4, 2018
Last update: November 4, 2018

graph2seq's People

Contributors

stevemart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graph2seq's Issues

Cannot reproduce BLEU score on test set

Hi,

I couldn't find a way in the code to reproduce the BLEU score of 38.97 you published in your paper on the test set of WikiSQL.

Can you please instruct me on how to reproduce it?

Thanks.

slice index 0 of dimension 0 out of bounds.

Hi..

I have a problem when run this code "!python ./main/run_model.py train". im getting this error " ValueError: slice index 0 of dimension 0 out of bounds. for '{{node Decoder/strided_slice_1}} = StridedSlice[Index=DT_INT32, T=DT_INT32, begin_mask=0, ellipsis_mask=0, end_mask=0, new_axis_mask=0, shrink_axis_mask=1](Decoder/Shape_1, Decoder/strided_slice_1/stack, Decoder/strided_slice_1/stack_1, Decoder/strided_slice_1/stack_2)' with input shapes: [0], [1], [1], [1] and with computed input tensors: input[1] = <0>, input[2] = <1>, input[3] = <1>."

Thanks.

Some issues about aggregators.py file

In the GatedMeanAggregator class ,I find that when parameter "concat" was False, I can't create it.

Because the attribute “output_dim” of the class will be set only when "concat" is True,while when create self.vars['bias'] variable, self.output_dim is needed,but the class still doens't have this attribute.

Souce code is as follows:
...
if concat:
self.output_dim = 2 * output_dim
...
if self.bias:
self.vars['bias'] = zeros([self.output_dim], name='bias')
...

I'm not so good at English ,sorry for my poor expression.

can't reproduce the results in your paper

I find you are still using the python 3.6 which I think is the problem.
Can you try to use the python 3.5 for this experiment ?

Bests,
Kun

在 2018年12月9日,20:03,Liam [email protected] 写道:

Kun, many thanks to you again~ I tried it on GPU based tensorflow and got the same level result as CPU based, here is my running log: https://colab.research.google.com/drive/16JmGN7coPxOa1W9inpvgzXc0uucwDYGa https://colab.research.google.com/drive/16JmGN7coPxOa1W9inpvgzXc0uucwDYGa

You are receiving this because you commented.
Reply to this email directly, view it on GitHub #2 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AOhkYIWmyY8zdAa5r3lySsZfibmIQ0rVks5u3d0IgaJpZM4ZJ4uK.

_Originally posted by @syxu828 in

#2 (comment)_

Hi,kun: I use python3.5 and tensorflow-gpu==1.8.0. the hyperparameters were set as you suggested in this answer. But finally got acc on test set is 0.951.(CUDA_VISIBLE_DEVICES=3 python run_model.py test -sample_size_per_layer=100 -hidden_layer_dim=50 -epochs=200)

Different performances between different python versions

My setting and data is totally implemented from your repository, I see from your paper that the results of "Path Finding" is 99.99 %, however, after running 100 epochs(which is your default epoch number), the best acc on Dev is only 0.145, and the best acc on Test is only 0.119 which is extremely different from what you have got .

I want to reproduce your results as the paper said. Is there any tricks I missed or something else?

Thanks for your patience~

what does "ID in the graph" mean?

Hi,

"g_ids" is a mapping from the node ID to its ID in the graph

What does "ID in the graph" mean? I saw the examples and found that node ID and graph ID are the same.

Thanks

Problem in Preparing data

Hi

I found a problem to preparing the data. Can you provide rawdata before train.data is generated?

I have data like this :
image

How to pad the graph if the size of each graph is different

Hi,

I am trying to implement the SQL-to-Text paper with the Graph2Seq model on WikiSQL dataset. When preparing the g_ids for the graph, it seems that we need to pad the nodes from all the graphs to the same size. I am wondering if I just need to create PAD nodes isolated or the PAD nodes have to be connected to the graph in some way.

Thanks

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.