Logo Lanfrica

francois-meyer/sspg

Domain:

natural language processing

Record type:

softwaremodel
Creator:
fra
Host:
Code for training and evaluating subword segmental pointer generator models for data-to-text, as in the LREC-COLING paper "Triples-to-isiXhosa (T2X): Addressing the Challenges of Low-Resource Agglutinative Data-to-Text Generation" (Meyer and Buys, 2024). # SSPG Code for the subword segmental pointer generator (SSPG) proposed in the paper *Triples-to-isiXhosa (T2X): Addressing the Challenges of Low-Resource Agglutinative Data-to-Text Generation*, Francois Meyer and Jan Buys, LREC-COLING 2024. SSPG is implemented as a model in fairseq. The code in this repo can be used to train new SSPG models for data-to-text. Trained SSPG models can be used to generate text from data using either unmixed or dynamic decoding. The SSPG models trained for our paper (for isiXhosa and Finnish data-to-text) are publicly available: * SSPG for isiXhosa T2X data-to-text * SSPG for Finnish Hockey data-to-text ## Dependencies * python 3 * fairseq (commit: 806855bf660ea748ed7ffb42fe8dcc881ca3aca0) * pytorch 1.0.1.post2 * cuda 11.4 * nltk ## Usage Merge the sspg files with fairseq. ```shell git clone github.com git clone github.com # change to 806855bf660ea748ed7ffb42fe8dcc881ca3aca0 branch cd fairseq git checkout 806855bf660ea748ed7ffb42fe8dcc881ca3aca0 # copy files from ssmt to fairseq cp -r ../sspg/fairseq ./ cp -r ../sspg/fairseq_cli ./ ``` ## Instructions 1. Segment {train/valid/test}.data with BPE, leave {train/valid/test}.text unsegmented. 2. Preprocess the data files. ```shell python fairseq/fairseq_cli/preprocess.py --dataset-impl=raw \ --source-lang data --target-lang text \ --trainpref $DATA_DIR/train --validpref $DATA_DIR/valid --testpref $DATA_DIR/test \ --destdir $DATA_DIR/pre ``` 3. Train SSPG model. Setting the `--decoder-copy` argument equips the subword segmental sequence-to-sequence model with a copy mechanism (pointer generator). ```shell python fairseq/fairseq_cli/train.py --dataset-impl=raw \ $DATA_DIR --task subword_segmental_data2text --source-lang data --target-lang text \ --max-epoch 50 --optimizer adam --lr 0.001 --lr-scheduler inverse_sqrt \ --arch ssd2t --criterion subword_segmental_cross_entropy \ --encoder-bidirectional --decoder-attention True -- …