https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/prompt_parser.py
Is the proper way to weigh a group:
(tag1, tag2, tag3):2
or
(tag1, tag2, tag3:2)
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/prompt_parser.py
Is the proper way to weigh a group:
(tag1, tag2, tag3):2
or
(tag1, tag2, tag3:2)
https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/sd1_clip.py
import comfy.sd1_clip as s
tests = [
# Single tag weight tests
"tag1:2", # Basic weight outside parens
"(tag1:2)", # Single tag weight in parens
"(tag1:2, tag2)", # Weight inside group
"tag1:2, tag2", # Weight outside group
# Group tests for comparison
"(tag1, tag2:2)", # Weight on second tag in group
"(tag1, tag2):2", # Weight after group
"(tag1:2, tag2:3)", # Multiple weights in group
]
for t in tests:
print(t, "→", s.token_weights(t, 1.0))
output:
tag1:2 → [('tag1:2', 1.0)]
(tag1:2) → [('tag1', 2.0)]
(tag1:2, tag2) → [('tag1:2, tag2', 1.1)]
tag1:2, tag2 → [('tag1:2, tag2', 1.0)]
(tag1, tag2:2) → [('tag1, tag2', 2.0)]
(tag1, tag2):2 → [('tag1, tag2', 1.1), (':2', 1.0)]
(tag1:2, tag2:3) → [('tag1:2, tag2', 3.0)]
tested latest comfyui code in pynb:
- all tag weights must be inside parens
- group tag weight must be inside parens, only last applies
- group tag weight outside is an extra token