A Telegram bot you can deploy to mimick the way you talk! Fine tune a LLM on your own telegram messages.
Credits and inspiration to fusiousteabag who helped me with the fine tuning - repo
Credits and inspiration to shamspias on how to build a telegram bot with langchain - repo
- Python 3.11 was used (best to create a virtual environment using conda on venv)
- run pip install -r requirements.txt
- run your own local open source LLM api endpoint server (for this project i used textgen-webui). You will need to start your textgen-webui server with the
--api
flag to generate an api endpoint that the bot will call to generate responses. Refer to the textgen-webui repo for more details. - create a
.env
file and update your variables with your own telegram bot token, your own name, your own LLM api endpoint. refer to.env.example
for the variables you need to set. Your final.env
file should look like the.env.example
except with your own variables. - refer to this to get your own telegram bot token
run the following command
python run_bot.py
Refer more to furiousteabag repo and blog to see how he got his telegram messages and prepared the dataset for fine tuning. The methods used for fine tuning he also discussed and evaluated in his blog. Brilliant stuff!
- tiktoken (to calculate tokens)
- langchain (easy api to connect llm endpoints in python)
- pyTelegramBotAPI (python api to interface with telegram)