Skip to content

chujiezheng/DiffKS

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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{diffks-zheng-2020,
  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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages