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.
Open the following Google Colab notebook to use it on the go.
- Clone this repo to your local machine using
$ git clone https://github.com/Ar9av/transformer-nmt-chatbot.gitchange the working directory
$ cd transformer-nmt-chatbot- Install the requirements using the following commands
$ pip install -r requirements.txt
$ sudo apt-get install chromium-chromedriverIn the config.yml change the type parameter to test and run the following command
$ python main.pyYou 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:
Change the parameters in config.yml and change the type to train and run the following command.
$ python main.pyIf 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
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.
Change the type in config.yml to train and run the following command
$ python main.py
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
To get started...
-
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- 🔃 Create a new pull request using
hhttps://github.com/Ar9av/transformer-nmt-chatbot/compare/.

