Neural transition-based parser for Abstract Meaning Representation (AMR) producing state-of-the-art AMR parsing and reliable token to node alignments. See below for the different versions and corresponding papers. Note that, as of now, Structured-BART does not support standalone parsing mode. Use the action-pointer
branch to get a parser that can work standalone.
Current version (0.5.1
). Structured-BART (Zhou et al 2020b) encodes the parser state using specialized cross and self-attention heads and leverages BART's language model to replace the use of subgraph actions and lemmatizer, thus enabling a much simpler oracle with 100% coverage. Its yields 84.2
Smatch (84.7
with silver data and 84.9
with ensemble) on the AMR2.0 test-set without graph recategorization or external dependencies, excluding wikification. It also produces accurate word to node alignments. As of this writing, this is the best AMR parser published as per AMR2.0 test set scores, the standard benchmark.
Checkout the action-pointer
branch (derived from version 0.4.2
) for the Action Pointer Transformer
model (Zhou et al 2021) from NAACL2021. As the stack-Transformer, APT encodes the parser state in dedicated attention heads. APT uses however actions creating nodes to represent them. This decouples token and node representations yielding much shorter sequences than previous oracles with higher coverage. APT achieves 81.8
Smatch (83.4
with silver data and partial ensemble) on AMR2.0 test using RoBERTa embeddings and has an efficient shallow decoder. Due to aligner implementation improvements this code reaches 82.1
on AMR2.0 test, better that what is reported in the paper.
Checkout the stack-transformer
branch (derived from version 0.3.4
) for the stack-Transformer
model (Fernandez Astudillo et al 2020) from EMNLP findings 2020. The stack-Transformer masks dedicated cross attention heads to encode the parser state represented by stack and buffer. It yields 80.2
Smatch (81.3
with self-learning) on AMR2.0 test (this code reaches 80.5
due to the aligner implementation). Stack-Transformer can be used to reproduce our works on self-learning and cycle consistency in AMR parsing (Lee et al 2020) from EMNLP findings 2020, alignment-based multi-lingual AMR parsing (Sheth et al 2021) from EACL 2021 and Knowledge Base Question Answering (Kapanipathi et al 2021) from ACL findings 2021.
The code also contains an implementation of the AMR aligner from (Naseem et al 2019) with the forced-alignment introduced in (Fernandez Astudillo et al 2020).
Aside from listed contributors, the initial commit was developed by Miguel Ballesteros and Austin Blodgett while at IBM.
IBM-ers please look here for available parsing web-services, CCC installers/trainers, trained models, etc.
The code needs Pytorch 1.4
and fairseq 0.10.2
. We tested it with Python 3.6-3.7
. We use a set_environment.sh
script inside of which we activate conda/pyenv and virtual environments, it can contain for example
# inside set_environment.sh
[ ! -d venv ] && virtualenv venv
. venv/bin/activate
OR you can leave this empty and handle environment activation yourself i.e.
touch set_environment.sh
Note that all bash scripts always source set_environment.sh
, so you do not need to source it yourself.
To install clone and pip install
git clone git@github.ibm.com:mnlp/transition-amr-parser.git
cd transition-amr-parser
git checkout <branch> # for e.g. action-pointer, ignore for current version
. set_environment.sh # see above
pip install . # use --editable if to modify code
To test if install worked
bash tests/correctly_installed.sh
To do a mini-test with 25 annotated sentences that we provide. This should take 10 minutes. It wont learn anything but at least will run all stages.
bash tests/minimal_test.sh
If you want to align AMR data, the aligner uses additional tools that can be donwloaded and installed with
bash preprocess/install_alignment_tools.sh
See here for more install details
You first need to pre-process and align the data. For AMR2.0 do
. set_environment.sh
python preprocess/merge_files.py /path/to/LDC2017T10/data/amrs/split/ DATA/AMR2.0/corpora/
You will also need to unzip the precomputed BLINK cache. See issues in this repository to get the cache file (or the link above for IBM-ers).
unzip /path/to/linkcache.zip
To launch train/test use (this will also run the aligner)
bash run/run_experiment.sh configs/amr2.0-structured-bart-large-sep-voc.sh
you can check training status with
python run/status.py -c configs/amr2.0-structured-bart-large-sep-voc.sh
use --results
to check for scores once models are finished.
As of now Structured-BART
does not support standalone parsing. Use the
action-pointer
or stack-Transformer
branches for this.