chujiezheng / DiffKS

Difference-aware Knowledge Selection for Knowledge-grounded Conversation Generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DiffKS: Difference-aware Knowledge Selection

Codes for the paper: Difference-aware Knowledge Selection for Knowledge-grounded Conversation Generation

If you have any problem or suggestion, feel free to contact me: chujiezhengchn@gmail.com

Please cite this repository using the following reference:

@inproceedings{zheng-etal-2020-diffks,
  title="{D}ifference-aware Knowledge Selection for Knowledge-grounded Conversation Generation",
  author="Zheng, Chujie  and
      Cao, Yunbo  and
      Jiang, Daxin and
      Huang, Minlie",
  booktitle="Findings of EMNLP",
  year="2020"
}

Requirements

See requirements.txt.

Prepare Data

Download the Wizard of Wikipedia dataset (downloaded using Parlai, please refer to the Sequential Latent Knowledge Selection for the download details) and put the files in the folder ./Wizard-of-Wikipedia, or download the Holl-E dataset and put the files in the folder ./Holl-E.

For Wizard of Wikipedia (WoW):

python prepare_wow_data.py

For Holl-E:

python prepare_holl_data.py

Besides, download the pretrained wordvector, unzip the files in ./ and rename the 300-d embedding file as glove.txt.

Training

Our codes now only support single-GPU training, which requires at least 12GB memory.

For Wizard of Wikipedia:

python run.py \
    --mode train \
    --dataset WizardOfWiki \
    --datapath ./Wizard-of-Wikipedia/prepared_data \
    --wvpath ./ \
    --cuda 0 \
    --droprate 0.5 \
    --disentangle \ # the disentangled model, delete this line if train the fused model
    --hist_len 2 \
    --hist_weights 0.7 0.3 \
    --out_dir ./output \
    --model_dir ./model \
    --cache

For Holl-E:

python run.py \
    --mode train \
    --dataset HollE \
    --datapath ./Holl-E/prepared_data \
    --wvpath ./ \
    --cuda 0 \
    --droprate 0.5 \
    --disentangle \ # the disentangled model, delete this line if train the fused model
    --hist_len 2 \
    --hist_weights 0.7 0.3 \
    --out_dir ./output \
    --model_dir ./model \
    --cache

You can modify run.py and myCoTK/dataloader.py to change more hyperparameters.

Evaluation

For Wizard of Wikipedia:

python run.py \
    --mode test \
    --dataset WizardOfWiki \
    --cuda 0 \
    --restore best \
    --disentangle \ # the disentangled model, delete this line if train the fused model
    --hist_len 2 \
    --hist_weights 0.7 0.3 \
    --out_dir ./output \
    --model_dir ./model \
    --cache

For Holl-E:

python run.py \
    --mode test \
    --dataset Holl-E \
    --cuda 0 \
    --restore best \
    --disentangle \ # the disentangled model, delete this line if train the fused model
    --hist_len 2 \
    --hist_weights 0.7 0.3 \
    --out_dir ./output \
    --model_dir ./model \
    --cache

About

Difference-aware Knowledge Selection for Knowledge-grounded Conversation Generation


Languages

Language:Python 100.0%