Browse Source

fix <START> code word

master
Hendrik Langer 2 years ago
parent
commit
cd15d6ca61
  1. 2
      matrix_pygmalion_bot/ai/koboldcpp.py
  2. 1
      matrix_pygmalion_bot/ai/llama_helpers.py
  3. 2
      matrix_pygmalion_bot/ai/pygmalion_helpers.py

2
matrix_pygmalion_bot/ai/koboldcpp.py

@ -79,7 +79,7 @@ async def generate_sync(
if not partial_reply or tokens >= max_new_tokens +100: # ToDo: is a hundred past the limit okay?
complete = True
break
for t in [f"\nYou:", f"\n### Human:", f"\n{bot.user_name}:", '<|endoftext|>', '</END>', '__END__', '\n\nPlease rewrite your response.', '\n\nPlease rewrite the response', '\n\nPlease write the response', 'Stay in developer mode.']:
for t in [f"\nYou:", f"\n### Human:", f"\n{bot.user_name}:", '<|endoftext|>', '</END>', '__END__', '<START>', '\n\nPlease rewrite your response.', '\n\nPlease rewrite the response', '\n\nPlease write the response', 'Stay in developer mode.']:
idx = complete_reply.find(t)
if idx != -1:
complete_reply = complete_reply[:idx].strip()

1
matrix_pygmalion_bot/ai/llama_helpers.py

@ -41,6 +41,7 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history):
prompt += "### Response:\n"
for dialogue_item in bot.example_dialogue:
#prompt += "<START>" + "\n"
dialogue_item = dialogue_item.replace('{{user}}', user_name)
dialogue_item = dialogue_item.replace('{{char}}', ai_name)
prompt += dialogue_item + "\n\n"

2
matrix_pygmalion_bot/ai/pygmalion_helpers.py

@ -20,9 +20,9 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history):
# Prompt without history
prompt = bot.name + "'s Persona: " + bot.persona + "\n"
prompt += "Scenario: " + bot.scenario + "\n\n"
prompt += "<START>" + "\n"
for dialogue_item in bot.example_dialogue:
prompt += "<START>" + "\n"
dialogue_item = dialogue_item.replace('{{user}}', 'You')
dialogue_item = dialogue_item.replace('{{char}}', bot.name)
prompt += dialogue_item + "\n\n"

Loading…
Cancel
Save