Git Product home page Git Product logo

transformer-nmt-chatbot's Introduction

Chatbot based on Transformer NMT Model

nmt-chatbot is the implementation of chatbot using Google's Transformer model for language understanding. Main purpose of this project is to make a chatbot, but it's fully compatible with Neural Machine Translation and still can be used for sentence translations between two languages.

Straight Usage

Open the following Google Colab notebook to use it on the go.

Link to colab notebook

Installation

Clone

  • Clone this repo to your local machine using
$ git clone https://github.com/Ar9av/transformer-nmt-chatbot.git

change the working directory

$ cd transformer-nmt-chatbot

Setup

  • Install the requirements using the following commands
$ pip install -r requirements.txt
$ sudo apt-get install chromium-chromedriver

Testing the Chatbot

In the config.yml change the type parameter to test and run the following command

$ python main.py

Example

You would get an interface in the terminal.

Here is an example of mental health chatbot which I trained on r/therapy, r/mentalhealth subreddit for 100 epochs:

chat-example

Configuring the Training Parameters

Change the parameters in config.yml and change the type to train and run the following command.

$ python main.py

Custom Dataset

If you're using your own custom dataset keep it in the following format.

Change the parameter reddit_data in config.yml to False.

The training data should be inside the data folder. The conversation data should be kept in 2 files train.to and train.from. Each line denotes the id of each 1-1 conversation in from and to form. train.from:

Hey
How are you

train.from:

Hi
I am fine

Train on Reddit's conversation threads

You can directly train it over reddit conversations just by providing the subreddits and number of pages for which you want the data. You can configure this using config.yml and change the reddit_data to True. You can mention the subreddits, pages, sorting criteria in reddit_config.yml.

reddit-config

Change the type in config.yml to train and run the following command

$ python main.py

Reddit Auto Reply Scripting

After training over a subreddit data, we can use the model to interference through the the comments and generate reply using reddit_bot.py

Configure the bot (app), user credentials in reddit_credentials.yml

$ python reddit_bot.py

Contributing

To get started...

Step 1

  • Option 1

    • ๐Ÿด Fork this repo!
  • Option 2

    • ๐Ÿ‘ฏ Clone this repo to your local machine using
$ git clone https://github.com/Ar9av/transformer-nmt-chatbot.git

Step 2

transformer-nmt-chatbot's People

Contributors

ar9av avatar kristafari 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.