1
0
Fork 0

fix wildcard scripts to work on windows

This commit is contained in:
BZLibby 2023-07-12 22:39:02 -05:00 committed by Sean Sube
parent ae6166aaf9
commit 5ecc874c70
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ MAX_TOKENS_PER_GROUP = 77
CLIP_TOKEN = compile(r"\<clip:([-\w]+):(\d+)\>") CLIP_TOKEN = compile(r"\<clip:([-\w]+):(\d+)\>")
INVERSION_TOKEN = compile(r"\<inversion:([^:\>]+):(-?[\.|\d]+)\>") INVERSION_TOKEN = compile(r"\<inversion:([^:\>]+):(-?[\.|\d]+)\>")
LORA_TOKEN = compile(r"\<lora:([^:\>]+):(-?[\.|\d]+)\>") LORA_TOKEN = compile(r"\<lora:([^:\>]+):(-?[\.|\d]+)\>")
WILDCARD_TOKEN = compile(r"__([-/\w]+)__") WILDCARD_TOKEN = compile(r"__([-/\\\w]+)__")
INTERVAL_RANGE = compile(r"(\w+)-{(\d+),(\d+)(?:,(\d+))?}") INTERVAL_RANGE = compile(r"(\w+)-{(\d+),(\d+)(?:,(\d+))?}")
ALTERNATIVE_RANGE = compile(r"\(([^\)]+)\)") ALTERNATIVE_RANGE = compile(r"\(([^\)]+)\)")

View File

@ -474,7 +474,7 @@ def load_wildcards(server: ServerContext) -> None:
) )
for file in wildcard_files: for file in wildcard_files:
with open(path.join(server.model_path, "wildcard", f"{file}.txt"), "r") as f: with open(path.join(server.model_path, "wildcard", file), "r", encoding="utf-8") as f:
lines = f.read().splitlines() lines = f.read().splitlines()
lines = [line.strip() for line in lines if not line.startswith("#")] lines = [line.strip() for line in lines if not line.startswith("#")]
lines = [line for line in lines if len(line) > 0] lines = [line for line in lines if len(line) > 0]