Coder Social home page Coder Social logo

ecm-tf's Introduction

Emotional Chatting Machine: Emotional Conversation Generation with Internal and External Memory

Introduction

This project is a tensorflow implement of Emotional Conversation Generation. We revise the interface of the seq2seq model on tensorflow to realize our model.

requirements

  • Python 3.5
  • Tensorflow 1.0.1
  • Numpy

Usage

  1. train
python train.py -m [model name]

We provide three models, including isolated emotion embedding('embedding') and internal memory('internal') and the mixed one('ECM'). You can set the batch size and the learning rate in this script. As long as we know, no optimizers other than SGD can perform well on this model, so there is no option for optimizers.

  1. test
python test.py -m [model name]

This script will generate a pickle file named "test_result_"+model_chosen+".pkl" consisting of posts, ground truth and the generated responses.

  1. apply
python apply.py -m [model name] -p [model path]

We provide a simple application script. When running this script, you need to enter what you want to say to the machine(which should be in Chinese and segmented) and the emotion category(1 for like, 2 for sadness, 3 for disgust, 4 for anger, 5 for happiness and 0 for other), then it will return you a response. We provide three pretrained models, and you can use your own trained model, too.

TODO

  • Add external memory to the model.
  • Speed up the application.

ecm-tf's People

Contributors

chmxu avatar

Stargazers

 avatar  avatar  avatar QianYin avatar Zhou Shifeng avatar  avatar  avatar Zoe avatar  avatar Xiao Xu avatar Yiheng Shu avatar Mingjian W avatar  avatar  avatar Saner3 avatar Bati Meng avatar Yumeng Li avatar  avatar

Watchers

 avatar

ecm-tf's Issues

can you give a data sample

i didnt find data_origin.pkl and other data sample;
can you give a data sample,then we can make our train data and test data

数据集 KeyError: '<START>'

请问train_data.json 是下面这个数据集吗?
image

image

而且我找不到data_medium.pkl and word2idx_mini.pkl,
希望您能提供帮助,谢谢!

Dimension Mismatch in MatMul in model_revise.py

decoder_outputs, decoder_states = tf.contrib.legacy_seq2seq.attention_decoder(decoder_inputs, h, attention_states, cell, num_heads=1, output_size=self.vocab_num)

is throwing following error

ValueError: Dimensions must be equal, but are 456 and 356 for 'attention_seq2seq/rnn/rnn/multi_rnn_cell/cell_0/cell_0/gru_cell/MatMul_68' (op: 'MatMul') with input shapes: [?,456], [356,512].

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.