support comments in wildcard files

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-01-23 10:07:38 +01:00
parent 578a16c65d
commit a673ed2411
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -4,6 +4,7 @@
- **Features**
- **caption** tab support for Booru tagger models, thanks @CalamitousFelicitousness
- add SmilingWolf WD14/WaifuDiffusion tagger models, thanks @CalamitousFelicitousness
- support comments in wildcard files, using `#`
- support aliases in metadata skip params, thanks @CalamitousFelicitousness
- **Internal**
- **cuda**: update to `torch==2.10.0`
+3 -1
View File
@@ -144,8 +144,10 @@ def apply_file_wildcards(prompt, replaced = [], not_found = [], recursion=0, see
try:
with open(file, 'r', encoding='utf-8') as f:
lines = f.readlines()
lines = [line.split('#')[0].strip('\n').strip() for line in lines]
lines = [line for line in lines if len(line) > 0]
if len(lines) > 0:
choice = random.choice(lines).strip(' \n')
choice = random.choice(lines)
if '|' in choice:
choice = random.choice(choice.split('|')).strip(' []{}\n')
prompt = prompt.replace(f"__{wildcard}__", choice, 1)