HKUST-KnowComp / PipeNet

Code for PipeNet: Question Answering with Semantic Pruning over Knowledge Graphs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse-LM-GNN

This is the code repo for *SEM 2024: PipeNet: Question Answering with Semantic Pruning over Knowledge Graphs

Envs

python: 3.7.13 transformers: 3.4.0

Data Preparation

We use the question answering datasets (CommonsenseQA and OpenBookQA), as well as ConceptNet as the knowledge source.

sh download_raw_data.sh

The datasets are processed by preprocess_prune.py. It grounds the concept in ConceptNet with calculating the distance score at the same time. It also generates pruned knowledge subgraph. e.g., preprocess CSQA with prune rate 0.9:

python preprocess_prune.py --run csqa --prune 0.9

Training

For CommonsenseQA, run

sh run_pipenet_csqa.sh

For OpenBookQA, run

sh run_pipenet_obqa.sh

For OpenBookQA with additional fact knowledge, download the pretrained model AristoRoBERTa first.

Evaluation

For CommonsenseQA, run

run eval_pipenet_csqa.sh

For OpenBookQA, run

run eval_pipenet_obqa.sh

About

Code for PipeNet: Question Answering with Semantic Pruning over Knowledge Graphs

License:MIT License


Languages

Language:Python 93.3%Language:Shell 6.7%