Official Implementation for Stylized Dialogue Generation with Feature-Guided Knowledge Augmentation (EMNLP2023 Findings).
Introducing KASDG: A Stylized Dialogue Response Generator that leverages style corpus from Knowledge Base perspective. KASDG extracts style knowledge from a style corpus and employs a uniquely designed Feature-Guided Selection Module, integrating Response-Related Contrastive Learning and Style Responsiveness Kullback-Leibler loss.
-
Reddit : Dialogue Corpus.
-
TCFC : Style corpus that contains the Formal and Informal styles.
-
ArXiv & Holmes : Style corpus that contains Holmes and ArXiv styles.
We tested our code on CUDA 11.4.
cd KASDG
conda create -n kasdg python=3.10
pip install -r requirements.txt
conda activate kasdg
- Model: Download the pretrained weights of bart and bart_dialogue. Move them to
model
and name asbart
,bart_dialogue
, respectively. - Dataset : We provide our used dataset in
data
. Same data can be downloaded from links mentioned inDataset
section. - Preprocess : To preprocess the data and complete the retrieval process overhead
python src/prepare_data.py --dataset='your_dataset' --preprocess=1
- To train a model
python train.py --dataset='your_dataset'
- To predict or test with a trained model
python eval.py --load_path='your_model_path' --load_step==your_step --dataset='your_dataset'
We use the same evaluation metrics as the original paper. For TCFC
evaluations, please refer to this paper. For ArXiv&Holmes
evaluations, please refer to this paper. You can also use your own metrics to evaluate the performance.
If you find our work useful in your research, please consider citing:
If you have any questions, please open a github issue or contact us:
Zekai Zhang: [email protected]
Jinpeng Li: [email protected]