Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 2.3 KB

README.md

File metadata and controls

47 lines (32 loc) · 2.3 KB

KASDG

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.

Dataset

  • Reddit : Dialogue Corpus.

  • TCFC : Style corpus that contains the Formal and Informal styles.

  • ArXiv & Holmes : Style corpus that contains Holmes and ArXiv styles.

Environment

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

Preparation

  • Model: Download the pretrained weights of bart and bart_dialogue. Move them to model and name as bart,bart_dialogue, respectively.
  • Dataset : We provide our used dataset in data. Same data can be downloaded from links mentioned in Dataset section.
  • Preprocess : To preprocess the data and complete the retrieval process overhead python src/prepare_data.py --dataset='your_dataset' --preprocess=1

Usage

  • 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'

Evaluation

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.

Citation

If you find our work useful in your research, please consider citing:

Contact

If you have any questions, please open a github issue or contact us:

Zekai Zhang: [email protected]

Jinpeng Li: [email protected]