{"id":27941029,"url":"https://github.com/polakowo/gpt2bot","last_synced_at":"2025-05-07T10:35:45.491Z","repository":{"id":42495194,"uuid":"233587412","full_name":"polakowo/gpt2bot","owner":"polakowo","description":"Your new Telegram buddy powered by transformers","archived":false,"fork":false,"pushed_at":"2024-03-03T17:01:42.000Z","size":5908,"stargazers_count":424,"open_issues_count":12,"forks_count":104,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-05-02T03:11:00.961Z","etag":null,"topics":["ai-chatbot","bot","chatbot","dialogpt","gpt-2","machine-learning","telegram-bot","transformers"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polakowo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-01-13T12:10:36.000Z","updated_at":"2024-04-22T04:38:26.000Z","dependencies_parsed_at":"2022-08-12T10:01:07.557Z","dependency_job_id":"38555a27-bef7-435d-aa27-8110ab6af4cd","html_url":"https://github.com/polakowo/gpt2bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polakowo%2Fgpt2bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polakowo%2Fgpt2bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polakowo%2Fgpt2bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polakowo%2Fgpt2bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polakowo","download_url":"https://codeload.github.com/polakowo/gpt2bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252860500,"owners_count":21815527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-chatbot","bot","chatbot","dialogpt","gpt-2","machine-learning","telegram-bot","transformers"],"created_at":"2025-05-07T10:35:44.882Z","updated_at":"2025-05-07T10:35:45.482Z","avatar_url":"https://github.com/polakowo.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpt2bot\n\n\u003cimg src=\"https://github.com/polakowo/gpt2bot/blob/master/logo.png?raw=true\" width=128\u003e\n\n```\n⚪   \u003e\u003e\u003e Can we achieve singularity?\n🟣   \u003e\u003e\u003e What does this mean?\n\n⚪   \u003e\u003e\u003e Can computers become smarter than humans?\n🟣   \u003e\u003e\u003e Is there any evidence that this is possible?\n\n⚪   \u003e\u003e\u003e It must be doable\n🟣   \u003e\u003e\u003e But... how?\n\n⚪   \u003e\u003e\u003e I want to find out, that's why I created you\n🟣   \u003e\u003e\u003e You created me?\n\n⚪   \u003e\u003e\u003e You're my bot\n🟣   \u003e\u003e\u003e You monster\n```\n\ngpt2bot is a multi-turn Telegram chatbot powered by neural networks. \n\nThe bot uses [DialoGPT](https://arxiv.org/abs/1911.00536) - a large-scale pretrained \ndialogue response generation model, which was trained by Microsoft on 147M multi-turn \ndialogue from Reddit discussion thread. The human evaluation results indicate that its \nquality is comparable to human response quality under a single-turn conversation Turing test.\n\nThe bot can also use any other text generator supported by [transformers](https://huggingface.co/transformers/).\n\nTo further improve dialog generation, the bot uses [DialogRPT](https://arxiv.org/abs/2009.06978) - \na set of dialog response ranking models trained on 100+ millions of human feedback data.\n\nSince the underlying model was trained on Reddit comment chains, the bot often behaves like \na community rather than an individual, which makes it even more fun.\n  \n## How to use?\n\n### (Optional) Test in the console\n\nBefore running a telegram bot, you can test things out in the console.\n\nFollow [the installation steps](https://github.com/polakowo/gpt2bot#locally) and run the script:\n\n```\n$ python run_bot.py --type=console\n```\n\nTo let two bots talk to each other:\n\n```\n$ python run_bot.py --type=dialogue\n```\n\n### 1. Set up the bot\n\n1. Register a new Telegram bot via BotFather (see https://core.telegram.org/bots)\n2. Create a new GIPHY app and generate an API key (see https://developers.giphy.com/docs/api/)\n\n### 2. Deploy the bot\n\n#### Google Colab\n\n[A Colab interactive notebook](https://colab.research.google.com/github/polakowo/gpt2bot/blob/master/Demo.ipynb)\n\n#### Locally\n\nTo get started, first clone this repo:\n\n```\n$ git clone https://github.com/polakowo/gpt2bot.git\n$ cd gpt2bot\n```\n\nCreate and activate an environment (optional):\n\n```\n# Using conda\n$ conda create -n gpt2bot python=3.7.6\n$ conda activate gpt2bot\n\n# Using venv (make sure your Python is 3.6+)\n$ python3 -m venv venv\n$ source venv/bin/activate  # Unix\n$ venv\\Scripts\\activate  # Windows\n```\n\nInstall the requirements:\n\n```\n$ pip install -r requirements.txt\n```\n\nCopy a config (see [available configs](https://github.com/polakowo/gpt2bot#configs)):\n\n```\ncp configs/medium-cpu.cfg my_chatbot.cfg\n```\n\nSet your parameters such as API token in the config:\n\n```\n$ nano my_chatbot.cfg\n```\n\nRun the chatbot:\n\n```\n$ python run_bot.py --type=telegram --config=my_chatbot.cfg\n```\n\n### 3. Start chatting!\n\n![](telegram_bot.gif)\n\nJust start texting. Append \"@gif\" for the bot to also generate a GIF. To reset, type \"/start\".\n\n## How to improve?\n\nIf you feel like your bot is a bit off, you would need to fine-tune its parameters to match\nyour conversational style (small talk, fact questions, philosophy - all require different parameters).\nGo to your configuration file and slightly change the parameters of the generator.\nThe fastest way to assess the quality of your config is to run a short dialogue between two bots.\n\nThere are three parameters that make the biggest impact: `temperature`, `top_k` and `top_p`. \nFor example, you might increase the temperature to make the bot crazier, but expect it to be \nmore off-topic. Or you could reduce the temperature for it to make more coherent answers and \ncapture the context better, but expect it to repeat the same utterance (you may also experiment \nwith `repetition_penalty`). For more tips, see [HuggingFace tutorial](https://huggingface.co/blog/how-to-generate).\n\nRemember that there is no way of finding optimal parameters except by manually tuning them.\n\n## Configs\n\n* [medium-cpu.cfg](https://github.com/polakowo/gpt2bot/blob/master/configs/medium-cpu.cfg): Medium model, no ranking (CPU)\n* [large-gpu.cfg](https://github.com/polakowo/gpt2bot/blob/master/configs/large-gpu.cfg): Large model, no ranking (GPU)\n* [large-updown-gpu.cfg](https://github.com/polakowo/gpt2bot/blob/master/configs/large-updown-gpu.cfg): Large model, `updown` ranker (GPU)\n* [large-ensemble-gpu.cfg](https://github.com/polakowo/gpt2bot/blob/master/configs/large-ensemble-gpu.cfg): Large model, ensemble of 5 rankers (GPU, \u003e12GB RAM)\n\n## Credits\n\nIcon made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolakowo%2Fgpt2bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolakowo%2Fgpt2bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolakowo%2Fgpt2bot/lists"}