Browse Source

fix strings

master
Hendrik Langer 2 years ago
parent
commit
21c65502a4
  1. 8
      matrix_pygmalion_bot/ai/runpod_pygmalion.py
  2. 8
      matrix_pygmalion_bot/ai/stablehorde.py
  3. 4
      runpod/runpod-worker-transformers/model_fetcher.py

8
matrix_pygmalion_bot/ai/runpod_pygmalion.py

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

8
matrix_pygmalion_bot/ai/stablehorde.py

@ -88,13 +88,13 @@ async def generate_sync(
reply = answer[:idx].strip()
else:
reply = answer.removesuffix('<|endoftext|>').strip()
reply = reply.replace("\n{bot_name}: ", " ")
reply.replace("\n<BOT>: ", " ")
reply = reply.replace(f"\n{bot_name}: ", " ")
reply.replace(f"\n<BOT>: ", " ")
return reply
else:
await asyncio.sleep(DELAY)
else:
return "<ERROR> {status}"
return f"<ERROR> {status}"
async def get_full_prompt(simple_prompt: str, bot, chat_history):
@ -185,7 +185,7 @@ async def generate_image(input_prompt: str, negative_prompt: str, model: str, ap
"nsfw": True,
"trusted_workers": False,
# "workers": [],
"models": ["{model}"]
"models": [f"{model}"]
}
logger.info(f"sending request to stablehorde.net")

4
runpod/runpod-worker-transformers/model_fetcher.py

@ -80,8 +80,8 @@ def download_model(model_name):
#https://huggingface.co/yahma/RWKV-14b_quant/resolve/main/RWKV-4-Pile-14B-20230213-8019.pqth
if snapshot_path:
print("model downloaded to \"{snapshot_path}\"")
os.system("ln -s \"{snapshot_path}\" /workdir/model")
print(f"model downloaded to \"{snapshot_path}\"")
os.system(f"ln -s \"{snapshot_path}\" /workdir/model")
# ---------------------------------------------------------------------------- #
# Parse Arguments #

Loading…
Cancel
Save