The refactored implementation for ACL2022 paper "Graph Pre-training for AMR Parsing and Generation". You may find our paper here (Arxiv). The original implementation is avaliable here
- python 3.8
- pytorch 1.8
- transformers 4.21.3
- datasets 2.4.0
- Tesla V100 or A100
We recommend to use conda to manage virtual environments:
conda env update --name <env> --file requirements.yml
You may download the AMR corpora at LDC.
Please follow this respository to preprocess AMR graphs:
bash run-process-acl2022.sh
bash run-posttrain-bart-textinf-joint-denoising-6task-large-unified-V100.sh /path/to/BART/
For AMR Parsing, run
bash train-AMRBART-large-AMRParsing.sh /path/to/pre-trained/AMRBART/
For AMR-to-text Generation, run
bash train-AMRBART-large-AMR2Text.sh /path/to/pre-trained/AMRBART/
cd evaluation
For AMR Parsing, run
bash eval_smatch.sh /path/to/gold-amr /path/to/predicted-amr
For better results, you can postprocess the predicted AMRs using the BLINK tool following SPRING.
For AMR-to-text Generation, run
bash eval_gen.sh /path/to/gold-text /path/to/predicted-text
If you want to run our code on your own data, try to transform your data into the format here, then run
For AMR Parsing, run
bash inference_amr.sh /path/to/fine-tuned/AMRBART/
For AMR-to-text Generation, run
bash inference_text.sh /path/to/fine-tuned/AMRBART/
Setting | Params | checkpoint |
---|---|---|
AMRBART-large | 409M | model |
Setting | BLEU(JAMR_tok) | Sacre-BLEU | checkpoint | output |
---|---|---|---|---|
AMRBART-large (AMR2.0) | 50.76 | 50.44 | model | output |
AMRBART-large (AMR3.0) | 50.29 | 50.38 | model | output |
To get the tokenized bleu score, you need to use the scorer we provide here. We use this script in order to ensure comparability with previous approaches.
Setting | Smatch | checkpoint | output |
---|---|---|---|
AMRBART-large (AMR2.0) | 85.6 | model | output |
AMRBART-large (AMR3.0) | 84.3 | model | output |
We thank authors of SPRING, amrlib, and BLINK that share open-source scripts for this project.
@inproceedings{bai-etal-2022-graph,
title = "Graph Pre-training for {AMR} Parsing and Generation",
author = "Bai, Xuefeng and
Chen, Yulong and
Zhang, Yue",
booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
month = may,
year = "2022",
address = "Dublin, Ireland",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2022.acl-long.415",
pages = "6001--6015"
}