GithubHelp home page GithubHelp logo

svirmi / gpt2bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from polakowo/gpt2bot

0.0 1.0 0.0 5.66 MB

Your new Telegram buddy trained on Reddit discussions using DialoGPT

License: MIT License

Python 33.33% Jupyter Notebook 66.25% Dockerfile 0.42%

gpt2bot's Introduction

gpt2bot

User >>> Can we achieve singularity?
Bot >>> What does this mean?
User >>> Can computers become smarter than humans?
Bot >>> Is there any evidence that this is possible?
User >>> It must be doable
Bot >>> But... how?
User >>> I want to find out, that's why I created you
Bot >>> You created me?
User >>> You're my bot
Bot >>> You monster

gpt2bot implements

The bot is built around DialoGPT - a large-scale pretrained dialogue response generation model trained by Microsoft, which was trained on 147M multi-turn dialogue from Reddit discussion thread. The human evaluation results indicate that its quility is comparable to human response quality under a single-turn conversation Turing test.

Since even with properly filtered Reddit dataset the model can generate toxic/inappropriate responses, the Microsoft team was unable to provide the decoding script. This repository implements the decoding script inspired by run_generation.py released earlier by Hugging Face. Moreover, it implements a Telegram bot that can be deployed locally, remotely, and even on Colab, and just makes testing fun.

How to use?

1. Create a Telegram bot

2. Deploy the bot

Google Colab

A Colab interactive notebook

A good thing about Google Colab is free GPU. So why not running the Telegram bot there, for blazingly fast chat? Run the notebook at daytime and do not forget to stop it at night.

Docker

  • Clone the repository
  • Set your parameters such as API token in dialog.cfg
  • To avoid re-downloading model files at each re-deployment, download the model files beforehand with
# cd gpt2bot/gpt2bot
python model.py
  • Finally, deploy the container from the root folder
docker build -t gpt2bot . && docker run gpt2bot

Manually

  • Clone the repository
  • Set your parameters such as API token in dialog.cfg
  • Install packages listed in requirements.txt
  • Run the script
# cd gpt2bot/gpt2bot
python telegram_bot.py
  • To test the things out in the console, run
python interactive_bot.py

3. Start chatting!

Just start texting. Append @gif for the bot to generate a GIF instead of text. To reset, type "Bye".

Updates

18/01/2020

  • EOS token is being checked during generation -> gpt2bot is now fast enough to be run on CPU.
  • Add support for maximum mutual information (MMI) -> more quality, but slower.

References

You can wait for a full DialoGPT release and then replace the decoder.

gpt2bot's People

Contributors

polakowo avatar

Watchers

James Cloos 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.