Coder Social home page Coder Social logo

lucko515 / chatbot-startkit Goto Github PK

View Code? Open in Web Editor NEW
59.0 7.0 39.0 6.81 MB

This repository holds files for the simple chatbot wrote in TensorFlow 1.4, with attention mechanism and bucketing.

Jupyter Notebook 26.67% Python 73.33%
chatbot tensorflow seq2seq attention-mechanism bucket lstm neural-network

chatbot-startkit's Introduction

Chatbot Startkit in TensorFlow 1.4

The example on how to implement simple chatbot using seq2seq model in the python using tensorflow 1.4 version. This Chatbot example shows the attention mechanism and bucketing as well.

Dataset

I've used the Cornell Movie Dialogs corpuse for this example. You can download it: here

Install

    Supported Python version

         - Python version used in this project: 3.5+

    Libraries used

Code

The core seq2seq model functions are all insude model_utils.py.

Data preprocessing and NLP functions are inside cornell_data_utils.py.

If you want to play with models hyperparameters use config.py.

Run

To run this project you will need some software, like Anaconda, which provides support for running .ipynb files (Jupyter Notebook).

After making sure you have that, you can run from a terminal or cmd next lines:

ipython notebook chatbot.ipynb

or

jupyter notebook chatbot.ipynb

License

IT License

Copyright (c) 2017 Luka Anicin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

chatbot-startkit's People

Contributors

lucko515 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatbot-startkit's Issues

Indentation Error !

Hey love your repository but there is a error in the model_utils.py file. In line 48 there is an indentation errror. Please fix this error as fast as possible.
Screenshot (47)

How to test the Saved model.

I have completed the training part and saved the model (checkpoints). It would be nice if you can update the code for testing the model.
Thanks

Cannot load movie_lines.txt - 'utf-8' codec can't decode byte 0xad in position 3767: invalid start byte

Dear Luka

Thanks for this repository. I am currently learning from it and I found the following error from the very beginning of loading the dataset:

sentences = {}
with open('cornell movie-dialogs corpus/movie_lines.txt', 'r') as f:
    for line in f.readlines():
        sentences[line.split(' +++$+++ ')[0]] = line.split(' +++$+++ ')[-1].replace('\n', "")

And the error is this:

---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-35-66409f9e14a9> in <module>()
      1 sentences = {}
      2 with open('cornell movie-dialogs corpus/movie_lines.txt', 'r') as f:
----> 3     for line in f.readlines():
      4         sentences[line.split(' +++$+++ ')[0]] = line.split(' +++$+++ ')[-1].replace('\n', "")

//anaconda/envs/tensorflow/lib/python3.5/codecs.py in decode(self, input, final)
    319         # decode input (taking the buffer into account)
    320         data = self.buffer + input
--> 321         (result, consumed) = self._buffer_decode(data, self.errors, final)
    322         # keep undecoded input until the next call
    323         self.buffer = data[consumed:]

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xad in position 3767: invalid start byte

Even if I download directly these text files from your repo: movie_answers_2.txt and movie_questions_2.txt, it shows same error:

---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-38-ae6b005fad2b> in <module>()
      4 with open('movie_questions_2.txt', 'r', encoding='utf-8') as f:
      5 
----> 6     lines = f.readlines()
      7 
      8     for text in lines:

//anaconda/envs/tensorflow/lib/python3.5/codecs.py in decode(self, input, final)
    319         # decode input (taking the buffer into account)
    320         data = self.buffer + input
--> 321         (result, consumed) = self._buffer_decode(data, self.errors, final)
    322         # keep undecoded input until the next call
    323         self.buffer = data[consumed:]

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xad in position 1085: invalid start byte

Can you please tell me what happened and how to fix this?

Thank you very much.

TypeError: 'NoneType' object is not iterable

Hi, I am getting the above error when executing the following line in chatbot.ipynb:
model = Chatbot(config.LEARNING_RATE,
config.BATCH_SIZE,
config.ENCODING_EMBED_SIZE,
config.DECODING_EMBED_SIZE,
config.RNN_SIZE,
config.NUM_LAYERS,
len(vocab),
word_to_id,
config.CLIP_RATE)

Please can you advise?

can't sample chat.

image
I apply above code generate sample. but it can't work. can you commit sample code. thanks very much.

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.