fix bot script post oasst_shared creation

This commit is contained in:
Andreas Köpf
2022-12-20 00:55:39 +01:00
parent 4519b7e08f
commit aa26c4ad03
9 changed files with 31 additions and 38 deletions
+1
View File
@@ -1,4 +1,5 @@
.venv
.env
*.pyc
*.swp
*.egg-info
-13
View File
@@ -1,13 +0,0 @@
install:
python -m pip install -U pip
python -m pip install -e .
lint: ## [Local development] Run pylint and black
python -m pylint app
python -m black --check -l 120 app
black: ## [Local development] Auto-format python code using black
python -m black -l 120 .
run:
python -m bot
+15 -9
View File
@@ -1,14 +1,20 @@
# open-assistant
# Open-Assistant Data Collection Discord Bot
This is the github repo for the open-assistant project.
We are currently building a discord bot in order to make everyone contribute with great prompts and answers.
Join us!
https://discord.gg/ZUfPw6jP
This bot collects human feedback to create a dataset for RLHF-alignment of an assistant chat bot based on a large langugae model. You and other people can teach the bot how to respond to user requests by demonstration and by garding and ranking the bot's outputs. If you want to learn more about RLHF please refer [to OpenAI's InstructGPT blog post](https://openai.com/blog/instruction-following/).
## Project description
## Invite official bot
We are calling the community for help to collect ChatGPT-like Instruction-Fulfillment datasamples via Discord. People can post Instructions they think would make sense for ChatGPT-like systems & also provide a good reference answer for it.
To add the official Open-Assistant data collection bot to your discord server [click here](https://discord.com/api/oauth2/authorize?client_id=1054078345542910022&permissions=1634235579456&scope=bot). The bot needs access to read the contents of user text messages.
## Todo
## Bot token for development
Figure out ouath flow for the app to work inside the open-chat-gpt testing channel here. https://discord.gg/JJSKtRhv
To test the bot on your own discord server you need to register a discord application at the [Discord Developer Portal](https://discord.com/developers/applications) and get at bot token.
1. Follow a tutorial on how to get a bot token, for example this one: [Creating a discord bot & getting a token](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token)
2. The bot script expects the bot token to be in an environment variable called `BOT_TOKEN`.
The simplest way to configure the token is via an `.env` file:
```
BOT_TOKEN=XYZABC123...
```
+1 -1
View File
@@ -3,7 +3,7 @@ import enum
from typing import Optional, Type
import requests
from schemas import protocol as protocol_schema
from oasst_shared.schemas import protocol as protocol_schema
class TaskType(str, enum.Enum):
+5 -5
View File
@@ -181,8 +181,8 @@ class OpenAssistantBot:
return msg
async def next_task(self):
task = self.backend.fetch_task(protocol_schema.TaskRequestType.rate_summary, user=None)
# task = self.backend.fetch_random_task(user=None)
# task = self.backend.fetch_task(protocol_schema.TaskRequestType.rate_summary, user=None)
task = self.backend.fetch_random_task(user=None)
msg: discord.Message = None
match task.type:
@@ -202,9 +202,9 @@ class OpenAssistantBot:
msg = await self.generate_rank_conversation(task)
if msg is not None:
await self.backend.ack_task(task.id, msg.id)
self.backend.ack_task(task.id, msg.id)
else:
await self.backend.nack_task(task.id, "not supported")
self.backend.nack_task(task.id, "not supported")
async def background_timer(self):
while True:
@@ -212,7 +212,7 @@ class OpenAssistantBot:
try:
await self.next_task()
except Exception as e:
print(e)
print(e.with_traceback())
await asyncio.sleep(30)
def run(self):
-10
View File
@@ -1,10 +0,0 @@
[
{
"prompt": "tell me the name of two dogs",
"responses": ["Charles", "bobby"]
},
{
"prompt": "Name one type of cheese made in france",
"responses": ["Munster", "Gouda"]
}
]
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# switch to bot directory
pushd "$parent_path/../../bot"
python3 __main__.py
popd