Skip to content

Learning to Select Knowledge for Response Generation in Dialog Systems

Notifications You must be signed in to change notification settings

bzantium/Posterior-Knowledge-Selection

Repository files navigation

PostKS (Posterior Knowledge Selection)

For decoder, I apply Hierarchical Gated Fusion Unit (HGFU) [Yao et al. 2017] and I only use three number of knowledges for the sake of code simplicity.



prerequisite

1. Install required packages

sh install.sh

2. Download and extract glove files and pickle as torch tensors.

sh download_glove.sh



Train model

If you run train, vocab.json and trained parameters will be saved. Then you can play demo.

python train.py --pre_epoch 5 --n_epoch 15 --n_batch 128



Play demo

python demo.py

You need to type three knowledges and utterance. Then bot will reply!

# example
Type first Knowledge: i'm very athletic.
Type second Knowledge: i wear contacts.
Type third Knowledge: i have brown hair.

you: hi ! i work as a gourmet cook .
bot(response): i don't like carrots . i throw them away . # reponse can change based on training.
  • If you type "change knowledge" at (you), you can retype three knowledges.
  • If you type "exit" at (you), you can terminate demo.



DataSet

  • I only use "self_original_no_cands" in Persona-chat released by ParlAI

About

Learning to Select Knowledge for Response Generation in Dialog Systems

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published