miku
Discord bot/companion for the group chatte, powered by the GPT-J Neo language model and modified with a soft prompt to understand all of our esoteric, elaborate inside jokes.
Setup
Python 3.8+ and PyTorch required. CUDA strongly recommended.
The c1-1.3B
model used in development should work without needing beefy hardware. It has been tested on a 1050 Ti 4 GB.
Set up a virtual environment:
Linux/MacOS
python3 -m venv venv
source venv/bin/activate
Windows
py -3 -m venv venv
.\venv\Scripts\activate
Install required packages
pip install -r requirements.txt
Copy .env.example
to .env
and fill in the bot's TOKEN
.
For chat scraping, you will also need to get your own USER_TOKEN
.
- In Discord, hit Ctrl+Shift+I to open up developer tools
- Go to the Network tab and filter by XHR requests
- Open a new channel, or scroll up, or do something else that will trigger an authenticated request
- Click on one that looks suitable (e.g.
messages?limit=50
) - Under the "Request" tab, copy the contents of the
Authorization
request header.
Usage
Scrape the messages from the chat channel you wish to use for a soft prompt. You will be prompted for the channel ID, which you can get by having developer mode on in Discord and right-clicking, or copying the last part of the URL in the browser.
cd src
python -m scraper
Train the soft prompt (TODO)
Run the Hatsune Miku bot. The first time you do this, it will download the model, which is ~5 GB.
python -m miku
Final Remarks
sukima nuts