Giter Site home page Giter Site logo

jcyk / gtos Goto Github PK

View Code? Open in Web Editor NEW
191.0 4.0 26.0 738 KB

Code for AAAI2020 paper "Graph Transformer for Graph-to-Sequence Learning"

License: MIT License

Python 98.53% Shell 1.09% Perl 0.38%
graph-transformer amr machine-translation graph-neural-networks

gtos's Introduction

Graph Transformer

Code for our AAAI2020 paper,

Graph Transformer for Graph-to-Sequence Learning. [preprint]

Deng Cai and Wai Lam.

1. Environment Setup

The code is tested with Python 3.6. All dependencies are listed in requirements.txt.

2. Data Preprocessing

The instructions for Syntax-based Machine Translation are given in the translator_data folder.

The instructions for AMR-to-Text Generation are given in the generator_data folder.


Step 3-6 should be conducted in the generator folder for AMR-to-Text Generation, and the translator folder for Syntax-based Machine Translation respectively. The default settings in this repo should reproduce the results in our paper.

3. Vocab & Data Preparation

cd generator/tranlator
sh prepare.sh # check it before use

4. Train

cd generator/tranlator
sh train.sh # check it before use

5. Test

cd generator/tranlator
sh work.sh # check it before use

# postprocess
sh test.sh (make sure --output is set)# check it before use

6. Evaluation

for bleu: use sh multi-bleu.perl (-lc)
for chrf++: use python chrF++.py (c6+w2-F2)
for meteor: use meteor-1.5 "java -Xmx2G -jar meteor-1.5.jar test reference -l en"

Citation

If you find the code useful, please cite our paper.

@inproceedings{cai-lam-2020-graph,
    title = "Graph Transformer for Graph-to-Sequence Learning",
    author = "Cai, Deng  and Lam, Wai",
    booktitle = "Proceedings of The Thirty-Fourth AAAI Conference on Artificial Intelligence (AAAI)",
    year = "2020",
}

Contact

For any questions, please drop an email to Deng Cai.

(Pretrained models and our system output are available upon request.)

gtos's People

Contributors

jcyk avatar ttslr 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

gtos's Issues

How to build custom dataset for gtos?

Thanks for the artefact. I am interested to apply this library for a machine translation task. However, in my case, I have to feed a custom dataset. Would you shed some light how can I build a custom graph to feed into the existing model?

Do you think is it possible with gtos?

Google Drive not available

Hi, the 'preprocessed data from Google Drive' is not available now... Would you please update the link? Thanks.

translation running hang

Hi,

Thanks for your great work. I was working on running the translator example and for some reason it seems the program never launches on the GPU. I noticed the default script has 4 GPUs. But since I only have one GPU, I changed it to 1. After that I launch the script. And it seems to just wait/hang there and I cannot see any application running on the GPU(using nvidia-smi). Should i change some more parameters in the train.sh script?. Please let me know. Thanks

Content of AMR, concept, relation and token

Hi,
I'm trying to use gtos' generator with my custom dataset.
Since I don't have LDC2017T10 dataset, and the code has less annotation about the content, I have some question when modifying my data structure into yours.

How's the structure to save the graph? Could you give an example?
And what is concept, relation, token means?
Since LDC2017T10 is a Graph2Text dataset, I suppose that concept means the node in graph, relation means the edge in graph, and token is the sequence that describe the graph.
image
For example, want-01, believe-01, boy, girl are concepts and ARG0, ARG1 are relations, and ["The", "boy", "wants", "the", "girl", "to", "believe", "him"] are tokens, am I right?

Question about the batch size

Hi,it seems that the relation encoder GRU cannot support batch_size, I just modify the code of the relation encoder is enough?

and why you didn't use batch_size such as 32 in training for acceleration

path to data directory

Hi, thanks for sharing.

I am quite confused at the path to the directory of AMR dataset. During data preprocessing, I put my data under gtos/generator_data/data/AMR/LDC2017T10, things go well. However, during, Vocab & Data Preparation, I need to move the data directory to gtos/data/AMR/... to make sh prepare.sh work.

Below is the log when I execute sh prepare.sh under gtos/generator. Is this running as expectation?

bad attribute li p2 None
bad concept instance i3 imperative
bad attribute value s Auf
bad attribute li n None
bad concept instance i imperative
bad attribute value s compatible
bad concept instance i imperative
bad concept instance i2 imperative
bad attribute value s2 Qui
bad concept instance e expressive
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
bad attribute value s3 (
bad attribute value s hope
bad attribute li a None
bad attribute value s2 critical
bad attribute quant p None
bad attribute value s4 It's
mode DATE_ATTRS_1 interrogative abstract concept cannot have an attribute
bad attribute value a yar
bad concept instance e2 expressive
bad attribute value a2 are
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
bad attribute value s Erneuerbare
polarity DATE_ATTRS_1 - abstract concept cannot have an attribute
bad attribute value s2 no
bad attribute value s Qaid
bad attribute value s Rahmatul
bad attribute value s Auf
bad concept instance i3 imperative
bad concept instance i imperative
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
bad concept instance i imperative
read from ../data/AMR/amr_2.0/train.txt.features.preproc, 36521 amrs
tot_paths 8993632 avg_path_length 4.038885068902085
extreme_long_paths 477832 extreme_long_paths_percentage 0.053130036897217944
multi_path_percentage 993488 7720428 0.12868302120037906
predictable token coverage (1. - copyable token coverage) 401995 624750 0.6434493797519008
make vocabularies
bad attribute li p2 None
bad concept instance i3 imperative
bad attribute value s Auf
bad attribute li n None
bad concept instance i imperative
bad attribute value s compatible
bad concept instance i imperative
bad concept instance i2 imperative
bad attribute value s2 Qui
bad concept instance e expressive
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
bad attribute value s3 (
bad attribute value s hope
bad attribute li a None
bad attribute value s2 critical
bad attribute quant p None
bad attribute value s4 It's
mode DATE_ATTRS_1 interrogative abstract concept cannot have an attribute
bad attribute value a yar
bad concept instance e2 expressive
bad attribute value a2 are
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
bad attribute value s Erneuerbare
polarity DATE_ATTRS_1 - abstract concept cannot have an attribute
bad attribute value s2 no
bad attribute value s Qaid
bad attribute value s Rahmatul
bad attribute value s Auf
bad concept instance i3 imperative
bad concept instance i imperative
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
polarity ORDINAL_ENTITY_1 - abstract concept cannot have an attribute
bad concept instance i imperative
read from ../data/AMR/amr_2.0/train.txt.features.preproc, 36521 amrs
read from ../data/AMR/amr_2.0/dev.txt.features.preproc, 1368 amrs
bad attribute quant t None
bad concept instance i imperative
day DATE_ATTRS_3 1 abstract concept cannot have an attribute
read from ../data/AMR/amr_2.0/test.txt.features.preproc, 1371 amrs

translator data preparation

Hi,

Thanks for your great work. I was working on running the translator example and for some reason it seems the program never launches on the GPU. I noticed the default script has 4 GPUs. But since I only have one GPU, I changed it to 1. After that I launch the script. And it seems to just wait/hang there and I cannot see any application running on the GPU(using nvidia-smi). Should i change some more parameters in the train.sh script?. Please let me know. Thanks

Questions on Generation Training/Test

In generate/postprocess.py, it looks like the golden_file is supposed to contain a json line starting with '# ::original ' but none of the preprocessing steps created this. Did I miss something? Any hints on where this should be generated from or an alternate method to get the ref_stream?

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.