https://github.com/flyingfathead/discord-gpt2-bot
A simple Discord chatbot for local GPT-2 TensorFlow models
https://github.com/flyingfathead/discord-gpt2-bot
chatbot chatbot-application chatbot-framework chatbots-framework discord discord-bot discord-py gpt-2 gpt-2-chatbot gpt2 gpt2-bot gpt2-chitchat python python311 tensorflow tensorflow2
Last synced: 4 months ago
JSON representation
A simple Discord chatbot for local GPT-2 TensorFlow models
- Host: GitHub
- URL: https://github.com/flyingfathead/discord-gpt2-bot
- Owner: FlyingFathead
- Created: 2023-08-05T16:51:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-05T21:03:28.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T12:07:05.105Z (4 months ago)
- Topics: chatbot, chatbot-application, chatbot-framework, chatbots-framework, discord, discord-bot, discord-py, gpt-2, gpt-2-chatbot, gpt2, gpt2-bot, gpt2-chitchat, python, python311, tensorflow, tensorflow2
- Language: Python
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Discord-GPT2-bot
A simple Discord chatbot powered by OpenAI's GPT-2 model, designed to run on local TensorFlow setups.# Install
1. **Clone the repository**```
git clone https://github.com/FlyingFathead/Discord-GPT2-bot
cd Discord-GPT2-bot/
```2. **Install dependencies**
```
pip install -r requirements.txt
```3. **Get the OpenAI GPT-2 model** and tune it according to your requirements. Place the model in the corresponding subdirectory (e.g., `models/124M/`). Ensure that the directory contains all necessary TensorFlow model files, including `vocab.bpe`, `encoder.json`, and `hparams.json`.
4. **Set up the bot** (see the code; fix the variables to suit your use scenario):
- Save your Discord API bot token in `token.txt` (one line).
- Define the bot's authorized users in `authorized_users.txt` (one username per line; syntax i.e. `UserName#0` or `UserName#xxxx`).6. **Optional & additional configuration**
- Feel free to configure various replacement lists for elements like unwanted URLs, words, strings, allowed channels etc. Refer to the source code for a complete list of replaceable items.8. **Run** with `python Discord-GPT2-bot.py` and enjoy! (?)
# Usage
Talk to the bot and it should respond.Commands:
- `!goodnight` - the bot shuts down (user must be in the authorized users list, `authorized_users.txt` by default)
- `!maxrolls x` - max number of replies to a single line (x = number of replies)
- `!odds x` - odds (probability) of the bot answering; 0 for 0%, 1 for 100%, use fractions like 0.5 = 50%
- `!temp x` - set the model's temperature (between 0 and 2). Optimal for an optimized model usually hangs at around 1.
- `!alert` - send out a test alert (for testing, debug purposes etc)# Notes
This is mostly for humorous & testing purposes, although the code works perfectly fine when set up correctly, don't expect miracles out of the bot. Actual performance depends on fine-tuning and model size, etc. -- Feel free to expand on its functionalities and adapt it to your needs.From [FlyingFathead](https://github.com/FlyingFathead/), in collaboration with ChaosWhisperer.