Skip to content

Commit

Permalink
Disable random messages, add more stop strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Elbios committed Dec 21, 2023
1 parent 7bfaebc commit 9367777
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async def bot_behavior(message):
# and the bot was mentioned in this guild
if message.guild and message.guild.id in bot_last_message_time:
time_since_bot_last_spoke = datetime.datetime.now() - bot_last_message_time[message.guild.id]
if time_since_bot_last_spoke.total_seconds() >= 20: # 2 minutes * 60 seconds
if time_since_bot_last_spoke.total_seconds() >= 200000: # 2 minutes * 60 seconds
# Check if there's a recorded channel from a bot mention
if message.guild.id in bot_last_mentioned_channel:
# await functions.write_to_log("Initiate random message send")
Expand Down
22 changes: 13 additions & 9 deletions configurations/text-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,33 @@
"instruction-response": "### Response",
"parameters": {
"prompt": "",
"stopping_strings": [],
"stop_sequence": [],
"add_bos_token": "True",
"ban_eos_token": "True",
"do_sample": "False",
"early_stopping": "False",
"max_length": 160,
"max_length": 400,
"max_tokens": 400,
"max_context_length": 2048,
"genamt": 1095,
"temp": 0.83,
"temp": 0.95,
"top_k": 0,
"top_p": 0.95,
"top_p": 0.75,
"top_a": 0,
"typical": 1,
"tfs": 0.95,
"rep_pen": 1.19,
"rep_pen_range": 1024,
"tfs": 1.0,
"rep_pen": 1.1,
"rep_pen_range": 128,
"rep_pen_slope": 0.9,
"use_default_badwordsids": "True",
"newline_as_stopseq": "True",
"early_stopping": "True",
"sampler_order": [
6,
0,
1,
2,
3,
4,
2,
5
]
}
Expand Down
4 changes: 3 additions & 1 deletion functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def create_text_prompt(user_input, user, character, bot, history, reply, t
prompt = character + history + reply + user + ": " + user_input + "\n" + image_prompt + "\n" + bot + ": "
else:
prompt = character + history + reply + user + ": " + user_input + "\n" + bot + ": "
stopping_strings = ["\n" + user + ":", user + ":", bot + ":", "You:", "@Ava", "User"]
stopping_strings = ["\n" + user + ":", user + ":", bot + ":", "You:", "@Ava", "User", "@" + user, "<|endoftext|>"]

data = text_api["parameters"]
data.update({"prompt": prompt})
Expand Down Expand Up @@ -235,6 +235,8 @@ def clean_user_message(user_input):

# Remove the bot's tag from the input since it's not needed.
user_input = user_input.replace("@Kobold","")

user_input = user_input.replace("<|endoftext|>","")

# Remove any spaces before and after the text.
user_input = user_input.strip()
Expand Down

0 comments on commit 9367777

Please sign in to comment.