Skip to content

CSS: Contrastive Span Selector for Multi-span Question Answering - PRICAI 2023 paper repository.

License

Notifications You must be signed in to change notification settings

phzh24/Contrastive-Span-Selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contrastive-Span-Selector

This repo provides the source code of our PRICAI-2023 paper: CSS: Contrastive Span Selector for Multi-span Question Answering.

This study investigates the Multi-span Question Answering task and achieves state-of-the-art performance.

Environment

datasets==2.12.0
numpy==1.24.3
python==3.10.0
torch==2.0.1+cu118
torch-scatter==2.1.1+pt20cu118
transformers==4.28.1

Note: To install torch-scatter, please refer to the installation instructions on the torch-scatter · PyPI page.

Data Preprocessing

  1. Download MultiSpanQA dataset from MultiSpanQA Homepage.
  2. Move the two dataset settings to ./data/{DATASET_SETTING}/raw, respectively.
  3. Run
python ./data/preprocess.py --dataset_setting "{DATASET_SETTING}"

DATASET_SETTING: multispan, or expanded.

Training

Note: Please update the code if you're not using wandb to log experiment data.

Multiple GPUs:

  1. Run
export WANDB_PROJECT=Contrastive-Span-Selector
export CUDA_VISIBLE_DEVICES=0,1
export OMP_NUM_THREADS=4
torchrun --nproc_per_node 2 ./src/main.py ./config/multispan-bert.json

Single GPU:

  1. In file ./config/multispan-bert.json, change the gradient_accumulation_steps parameter.
  2. Run
export WANDB_PROJECT=Contrastive-Span-Selector
export CUDA_VISIBLE_DEVICES=0
python ./src/main.py ./config/multispan-bert.json

Prediction

  1. In file ./config/multispan-bert-prediction.json, change the output_dir parameter to the directory of the best-performing checkpoint.
  2. Run
export CUDA_VISIBLE_DEVICES=0
python ./src/main.py ./config/multispan-bert-prediction.json

Paper Checkpoints

The paper checkpoints for the BERT-base-uncased model can be accessed via google drive link.

About

CSS: Contrastive Span Selector for Multi-span Question Answering - PRICAI 2023 paper repository.

Resources

License

Stars

Watchers

Forks

Languages