Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567



Making a Rick & Morty Chatbot for Chai | by Reiss Edler | Aug, 2021

Rick Bot in action

We’re going to be making a chatbot, based on Microsoft’s DialoGPT. I’ve seen lots of other guides on training chatbots, but I haven’t come across one which actually deploys the bot. This tutorial will cover deploying our new bot to Chai, a platform for creating and interacting with conversational AI’s. It will allow us to chat with the bot through a mobile app, from anywhere, at any time. We will also be able to see performance stats and watch our bot climb the Chai bot leaderboard.

By the end of this tutorial you will have your very own chatbot, like the one pictured above 😎

If you would rather start off small, head over to the chai docs for a much simpler and shorter tutorial on creating your first bot!

I made a Google Colab notebook which allows you to run all of the code featured in this blog really easily. You can find it here.

Almost all of the code for training this bot was made by Mohamed Hassan. Their code has been adapted to suit the tutorial better.
The training data has been fetched from this article by Andrada Olteanu on Kaggle

Let’s get started!

pip -q install transformers

DialoGPT is a chatbot model made by Microsoft. This will be the base for Rick Bot.

Chatting with the untrained bot

It’s capable of holding a conversation (sort of), but it doesn’t resemble Rick Sanchez at all yet.

Here we define some config. These can be tweaked to generate a slightly different bot.

1. How Conversational AI can Automate Customer Service

2. Automated vs Live Chats: What will the Future of Customer Service Look Like?

3. Chatbots As Medical Assistants In COVID-19 Pandemic

4. Chatbot Vs. Intelligent Virtual Assistant — What’s the difference & Why Care?

We’re using some Rick and Morty scripts from this article by Andrada Olteanu (the data can be found here)

We want the model to be aware of previous messages from the dialogue to help it decide what to say next. We call this context. The dataset has context from 7 previous messages.

Now, this is quite a hefty chunk of code but don’t worry you don’t need to understand it yet, we can cover this in later tutorials.

Let’s start training!

This should take around 10 minutes so you might as well go grab a cup of coffee ☕️

Conversation with Rick bot

That’s more like it!

HuggingFace is a platform for hosting machine learning models. Think Github for ML.

apt-get install git-lfs

Git needs an email address:

git config --global user.email <YOUR_EMAIL>

Login with your Huggingface account (if you don’t have one you can sign up here) and then push our new model:

huggingface-cli login

Following the link the code above gives us will take you to your bot’s Huggingface page, it will look something like this:

Rick Bot on Huggingface

Great! Now our bot is being hosted on HuggingFace we can deploy to Chai

Chai is a platform for creating, sharing and interacting with conversational AI’s. It allows us to chat with our new bot through a mobile app. This means you can show it off really easily, no need to whip out your laptop and fire up a colab instance, simply open the mobile app and get chatting!

There is also a bot leaderboard to climb. We can see how our new bot compares to others on the platform:

Credit: Source link

Previous Next
Test Caption
Test Description goes like this