Browse Source

postprocessing in correct order

master
Hendrik Langer 2 years ago
parent
commit
e4fdef932d
  1. 3
      matrix_pygmalion_bot/ai/koboldcpp.py
  2. 3
      matrix_pygmalion_bot/ai/runpod_pygmalion.py

3
matrix_pygmalion_bot/ai/koboldcpp.py

@ -95,11 +95,10 @@ async def generate_sync(
if complete_reply:
complete_reply = complete_reply.removesuffix('<|endoftext|>')
complete_reply = complete_reply.replace(f"\n{bot.name}: ", " ")
complete_reply = complete_reply.replace(f"\n<BOT>: ", " ")
complete_reply = complete_reply.replace(f"<BOT>", f"{bot.name}")
complete_reply = complete_reply.replace(f"<USER>", f"You")
complete_reply = complete_reply.replace(f"### Assistant", f"{bot.name}")
complete_reply = complete_reply.replace(f"\n{bot.name}: ", " ")
return complete_reply.strip()
else:
raise ValueError(f"<ERROR> Timeout")

3
matrix_pygmalion_bot/ai/runpod_pygmalion.py

@ -87,10 +87,9 @@ async def generate_sync(
reply = answer[:idx].strip()
else:
reply = answer.removesuffix('<|endoftext|>').strip()
reply = reply.replace(f"\n{bot.name}: ", " ")
reply = reply.replace(f"\n<BOT>: ", " ")
reply = reply.replace(f"<BOT>", f"{bot.name}")
reply = reply.replace(f"<USER>", f"You")
reply = reply.replace(f"\n{bot.name}: ", " ")
return reply
else:
err_msg = r_json["error"] if "error" in r_json else ""

Loading…
Cancel
Save