Giter VIP home page Giter VIP logo

empdg's Introduction

EmpDG: Multi-resolution Interactive Empathetic Dialogue Generation (COLING 2020)

This repository is the implementation of our COLING 2020 Paper EmpDG: Multi-resolution Interactive Empathetic Dialogue Generation.

Model Architecture

Image of EmpDG

Setup

  • Check the packages needed or simply run the command:
pip install -r requirements.txt
  • The dataset (empathetic-dialogue) is preprocessed and stored in pickle format:
.
└── empathetic-dialogue
    └── empdg_dataset_preproc.p
  • Download GloVe vectors from here (glove.6B.300d.txt) and put it into /vectors/.

  • For reproducibility purposes, we place the model checkpoints at Google Drive. You could download and move it under /result/.

  • To skip training, please check folder /Predictions/.

Run code

Training

EmpDG

# 1. Pre-train Empathetic Generator (EmpDG_woD)
# 2. Pre-train two Interactive Discriminators
# 3. Joint-train two components
python adver_train.py --cuda --label_smoothing --noam --emb_dim 300 --rnn_hidden_dim 300 --hidden_dim 300  --hop 1 --heads 2 --emotion_disc --pretrain_emb --model EmpDG --device_id 0 --save_path save/EmpDG/ --d_steps 1 --g_steps 5 --pointer_gen

EmpDG_woD

# Empathetic Generator
python train.py --cuda --label_smoothing --noam --emb_dim 300 --hidden_dim 300 --hop 1 --heads 2 --pretrain_emb --model EmpDG_woD --device_id 0 --save_path save/EmpDG_woD/ --pointer_gen

EmpDG_woG

# We regard the baseline EmoPrepend as generator, which only considers the coarse-grained emotional factor. 
# We only use the semantic discriminator to distinguish the generated responses and the gold ones. 

python adver_train_no_eg.py --cuda --label_smoothing --noam --emb_dim 300 --rnn_hidden_dim 300  --hidden_dim 300 --hop 1 --heads 2 --cuda --pretrain_emb --model EmpDG_woG --device_id 0 --save_path save/EmpDG_woG/ --d_steps 1 --g_steps 5 --pointer_gen 

Add --resume_g --resume_d into the command to directly use the pre-trained generator or discriminator.

Testing

EmpDG

Make sure that the trained model result/EmpDG_best.tar exists.

python train.py --test --cuda --label_smoothing --noam --emb_dim 300 --rnn_hidden_dim 300 --hidden_dim 300  --hop 1 --heads 2 --pretrain_emb --model EmpDG --device_id 0 --save_path save/EmpDG/ --pointer_gen

Demo

Reference & Acknowledgements

If you find our work useful, please cite our paper as follows:

@inproceedings{li-etal-2020-empdg,
  title={EmpDG: Multi-resolution Interactive Empathetic Dialogue Generation},
  author={Qintong Li and Hongshen Chen and Zhaochun Ren and Zhaopeng Tu and Zhumin Chen},
  booktitle={COLING},
  year={2020},
}

empdg's People

Contributors

qtli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.