This is the official implementation for paper CAB: Empathetic Dialogue Generation with Cognition, Affection and Behavior.
- Check the packages needed or simply run the command:
pip install -r requirements.txt
-
Download GloVe vectors from here (glove.840B.300d.txt) and put it into
/data/
. -
Download the completely processed dataset data from Google Drive and place it into
/data/
for experiments. -
If you want to see the annotated dataset with dialogue act label and both interlector's emotion lables, then you could:
- Download the processed EmpatheticDialogues dataset with dialogue act label and both interlector's emotion lables from here and place processed dataset
train.json, valid.json and test.json
into/data/ed_data/
.
- Download the processed EmpatheticDialogues dataset with dialogue act label and both interlector's emotion lables from here and place processed dataset
-
If you want to reconstruct knowledge paths, then you could:
- Download the processed ConceptNet data and place processed data
ConceptNet_ranked_dict.json
into/data/knowledge_data/
, meanwhile, download dataset_preproc.p and place it into/data/
.
- Download the processed ConceptNet data and place processed data
-
For reproducibility purposes, we place the model checkpoints. You could download and move it under
/save/final/
. -
To skip training, please check folder
/result/CAB/output.txt/
.
python main.py \
--cuda \
--batch_size 16 \
--lr 1e-4 \
--hidden_dim 300 \
--emo_dim 300 \
--act_dim 300 \
--latent_dim 200\
--hop 1 \
--heads 2 \
--pretrain_emb \
--model CAB \
--multi_hop 5 \
--K_num 5 \
--k_num 3 \
--path_num 15 \
--pointer_gen \
--emb_file data/glove.840B.300d.txt
Add
--test
into above commands.
You can directly run /evaluate_result.py
script to evaluate the model predictions.
If you find our work useful, please cite our paper as follows:
@article{CAB2023,
title={CAB: Empathetic Dialogue Generation with Cognition, Affection and Behavior},
author={Pan Gao, Donghong Han, Rui Zhou, Xuejiao Zhang, Zikun Wang},
journal={arXiv preprint arXiv:2302.01935},
year={2023},
}