Skip to content
/ HyKAS Public

Code for the paper "Towards Generalizable Neuro-Symbolic Systems for Commonsense Question Answering" (EMNLP-COIN 2019)

License

Notifications You must be signed in to change notification settings

Mayer123/HyKAS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Towards Generalizable Neuro-Symbolic Systems for Commonsense Question Answering

This repository contains the code for the paper "Towards Generalizable Neuro-Symbolic Systems for Commonsense Question Answering". See full paper here

Enviroments

This code has been tested on Python 3.6.7, Pytorch 1.2 and Transformers 2.3.0

Dataset

Please download the CommonsenseQA dataset from the official website

ConceptNet Knowledge Extraction

Go to directory Extraction, then download ConceptNet from the official website and uncompress in the current directory. Then simple run:

python extract_english.py 
python extract4commonsenseqa.py

This would generate the files in the data directory. To run extraction on datasets other than CommonsenseQA, you will need to modify the data loading and formatting accordingly.

ATOMIC Knowledge Generation

Note: If you only need to train models on CommonsenseQA, you can skip this part.

First clone the comet official repo and put files in comet-generation under scripts/interactive Then follow the instructions from official repo to download necessary data/models to run generation

HyKAS Model Training

CUDA_VISIBLE_DEVICES=0 python run_csqa.py --data_dir data/ --model_type roberta-ocn-inj --model_name_or_path 
roberta-large --task_name csqa-inj --cache_dir downloaded_models --max_seq_length 80 --do_train --do_eval 
--evaluate_during_training --per_gpu_train_batch_size 4 --gradient_accumulation_steps 8 --learning_rate 1e-5 
--num_train_epochs 8 --warmup_steps 150 --output_dir workspace/hykas

For CommonsenseQA, the Dev accuracy should get around 79%.

Cite

@inproceedings{ma-etal-2019-towards,
    title = "Towards Generalizable Neuro-Symbolic Systems for Commonsense Question Answering",
    author = "Ma, Kaixin and Francis, Jonathan and Lu, Quanyang and Nyberg, Eric and Oltramari, Alessandro",
    booktitle = "Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-6003",
    doi = "10.18653/v1/D19-6003",
    pages = "22--32",
}

About

Code for the paper "Towards Generalizable Neuro-Symbolic Systems for Commonsense Question Answering" (EMNLP-COIN 2019)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages