Chatting with a Deep learning brain

A Torch-powered conversational model

Julien Chaumond
HuggingFace
4 min readSep 7, 2016

--

TL;DR: If you just want to play with our AI side project experiment, scroll all the way down or head to http://neuralconvo.huggingface.co/

Last year, Google researchers published a widely-discussed paper titled “A Neural Conversational Model” which triggered a frenzy of reactions and articles such as Wired’s Google Made a Chatbot That Debates the Meaning of Life or Motherboard’s Google’s New Chatbot Taught Itself to Be Creepy.

Since then, conversational AI has been the hottest of topics in academia as well as in large tech companies like Facebook or Microsoft (remember Tay? we do too 😁). Right now, we’re at the stage where PhDs have written really good papers, open source implementations have started to emerge and mature, and startups can start building on this body of research to ship new products. Exciting times! 😎

Awesome? Creepy? Or both?

A solid implementation of Google’s paper called neuralconvo was started by Marc-André Cournoyer last December and is picking up steam fast.

Like Google’s bot, neuralconvo can be trained on the Cornell Movie-Dialogs Corpus, a widely-used NLP dataset made of 220,579 conversational exchanges between 10,292 pairs of movie characters.

Training Neuralconvo on a monster AWS g2.8xlarge GPU instance 😁

However, there’s not been an easy way to try out the resulting chatbot online. Selected excerpts from the research papers are hilarious or creepy (or both), but there’s not an easy way to run it and see for yourself.

So we built a simple interface to chat with the trained model here. The interface will feel familiar, as it looks like messaging products that we all love and use daily: http://neuralconvo.huggingface.co 🤓

Slick interface, am i right

Torch is a pretty awesome computing framework that is particularly well suited for machine learning as it makes it really easy to offload parallel computation to GPUs — something that’s not always easy with other AI frameworks. The only possible drawback for some of my machine learning friends is that Torch modules are scripted in Lua; the die-hard Python 🐍 afficionados might have a bit of cognitive load switching to Lua, considering all major AI frameworks use Python. I don’t mind Lua, so Torch is a pretty good fit for me.

I’m running Torch and neuralconvo on the largest GPU-powered Amazon Web Services instance, the g2.8xlarge. They’re running NVIDIA cards like the one below, which means with a little work it’s pretty straightforward to get CUDA-optimized code from Torch.

This is what’s physically in your g2.8xlarge instances.

Those instance are billed $2.60 per Hour at the time of this writing, and it takes around 48 hours to train the neuralconvo model with the parameters and dataset I used, so prepare to get a hefty AWS bill at the end of the month 😁

Finally, one major gotcha is that when you’re running a machine with multiple GPUs, you have to explicitly write your code to support parallel GPU work, which can be a bit tedious. You can see that with the `nvidia-smi` cli (see below). It would be really cool to write abstractions that would scale across GPUs, even though there will always be tricky parts. One relevant Torch issue is this one: https://github.com/torch/cutorch/issues/42

Out of the box, you’re running on one GPU only.

Anyways, we’d love you to try chatting with the AI and let us know what you think — if something funny happens you can always share the screenshot 😱

Why do we build this? As part of Betaworks’ Botcamp, my co-founder Clément and I are building Hugging Face (🤗), a conversational AI that’s fun to chat with. We build cutting-edge tech and aim at creating the most engaging AI ever. If you want to stay in the loop, hit “Recommend” and Subscribe below. Thanks!

--

--

Julien Chaumond
HuggingFace

Internet Entrepreneur, co-founder at Hugging Face (🤗). Hacker, singularitarian and neopagan; Follow me at @julien_c