Experiment code for: "A Generative Approach for Script Event Prediction via Contrastive Fine-tuning", AAAI 23.
Including main experiments and ablation experiments and the datasets we used. All experiments can be run directly through the corresponding configuration file when appropriate paths are set in the configuration file.
The public dataset: can be found here: GitHub - eecrazy/ConstructingNEEG_IJCAI_2018: The data and code for our IJCAI-ECAI 2018 paper: Constructing Narrative Event Evolutionary Graph for Script Event Prediction
cd mcnc
mkdir data
mkdir data/negg_data
# negg_data_dir represents the address of the downloaded dataset
mv negg_data_dir/corpus_index_dev.txt ./data/negg_data/dev
mv negg_data_dir/corpus_index_test.txt ./data/negg_data/test
mv negg_data_dir/corpus_index_train0.txt ./data/negg_data/train
We also uploaded this dataset along with the code. The original dataset:
Train: https://drive.google.com/file/d/19rIAU_mOOULFzJyyNu6Z-i3c5YvrfNCx/view
Dev: https://drive.google.com/file/d/1HQE8REOeCyfObtGH_M-usWRKx9CzmuKI/view
Test: https://drive.google.com/file/d/1IpWvEn-M90Qx6g_MIv5zDw_L8bYWcTFK/view
Bart_base_with_public_dataset(
# 1. stage1: event-centric pretraining
python main.py --config_file ./configs/main_experiments/bart_base_event-centric_pretraining.yaml
# 2. stage2: task-specific contrastive fine-tuning
# check ./log/date/bart_base_event-centric_pretraining.log and copy the last
# "best_checkpoint_path" to the "checkpoint_path" item of ./configs/main_experiments/bart_base_contrastive_fine-tuning.yaml
python main.py --config_file ./configs/main_experiments/bart_base_contrastive_fine-tuning.yaml
# check performance in ./log/date/bart_base_event-centric_pretraining.log
A similar process for repetition
An example for ablation method replace_with_a_linear_classifier.
# copy the above "best_checkpoint_path" path of Bart_base_with_public_dataset
# to the "checkpoint_path" item of ./configs/ablation_experiments/replace_with_a_linear_classifier.yaml
python main.py --config_file ./configs/ablation_experiments/replace_with_a_linear_classifier.yaml
# check performance in ./log/date/replace_with_a_linear_classifier.log
@article{zhu-etal-2023-script,
title={A Generative Approach for Script Event Prediction via Contrastive Fine-Tuning},
author={Zhu, Fangqi and Gao, Jun and Yu, Changlong and Wang, Wei and Xu, Chen and Mu, Xin and Yang, Min and Xu, Ruifeng},
journal={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={37},
number={11},
pages={14056-14064},
year={2023},
month={Jun},
url={https://ojs.aaai.org/index.php/AAAI/article/view/26645},
doi={10.1609/aaai.v37i11.26645}
}