Skip to content

Codes for the paper "Instantaneous Grammatical Error Correction with Shallow Aggressive Decoding" (ACL-IJCNLP 2021)

Notifications You must be signed in to change notification settings

AutoTemp/Shallow-Aggressive-Decoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shallow-Aggressive-Decoding

Codes for the paper "Instantaneous Grammatical Error Correction with Shallow Aggressive Decoding" (ACL-IJCNLP 2021) SAD

Results

The performance and online inference efficiency evaluation of baseline and our approach in CoNLL-14.
Model P R F0.5 Speedup
Transformer-big (beam=5) 73.0 38.1 61.6 1.0x
Our approach (9+3) 73.3 41.3 63.5 10.3x
Our approach (12+2 BART-Init) 71.0 52.8 66.4 9.6x
For reference, the beam=1 and beam=5 results of the state-of-the-art 12+2 (BART-Init) are:
12+2 BART-Init CoNLL-14 BEA-19
Beam P R F0.5 P R F0.5
1 71.0 52.8 66.4 74.7 66.4 72.9
5 71.4 52.8 66.7 75.8 66.3 73.7
The above models are all single models without ensemble.

Installation

conda create -n SAD python=3.6
conda activate SAD
conda install pytorch==1.5.1 torchvision==0.6.1 cudatoolkit=10.2 -c pytorch
cd fairseq
pip install --editable .

Usage

This section explains how to decode in different ways.

PTPATH=/to/path/checkpoint*.pt # path to model file
BINDIR=/to/path/bin_data # directory containing src and tgt dictionaries  
INPPATH=/to/path/conll*.bpe.txt # path to eval file
OUTPATH=/to/path/conll*.out.txt # path to output file
BATCH=xxx
BEAM=xxx

Directly use fairseq's interactive.py to decode:

bash interactive.sh $PTPATH $BATCH $BEAM $INPPATH $BINDIR $OUTPATH

Simplified greedy decoding:

python inference.py --checkpoint-path $PTPATH --bin-data $BINDIR --input-path $INPPATH --output-path $OUTPATH --baseline 

Aggressive decoding:

python inference.py --checkpoint-path $PTPATH --bin-data $BINDIR --input-path $INPPATH --output-path $OUTPATH --aggressive 

About

Codes for the paper "Instantaneous Grammatical Error Correction with Shallow Aggressive Decoding" (ACL-IJCNLP 2021)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published