Clean SDXL composition tags

This commit is contained in:
2026-06-27 22:06:37 +02:00
parent d546061959
commit 7f6bf0ffd8
3 changed files with 26 additions and 2 deletions
+8
View File
@@ -569,6 +569,13 @@ def _composition_label_issues(name: str, prompts: dict[str, str]) -> list[str]:
return issues
def _sdxl_composition_tag_issues(name: str, sdxl_prompt: str) -> list[str]:
for tag in (part.strip() for part in sdxl_prompt.split(",")):
if re.search(r"\bcomposition$", tag, flags=re.IGNORECASE):
return [f"{name}.sdxl_prompt: composition_tag_label"]
return []
def _trace_dict(formatter_name: str, payload: dict[str, Any]) -> tuple[dict[str, Any], str]:
trace_text = str(payload.get("route_trace_json") or "")
if not trace_text:
@@ -705,6 +712,7 @@ def _formatter_issues(
issues.extend(_caption_expression_grammar_issues(name, caption_text))
issues.extend(_krea_grammar_issues(name, krea_prompt))
issues.extend(_composition_label_issues(name, prompts))
issues.extend(_sdxl_composition_tag_issues(name, sdxl_prompt))
for label, value in (
(f"{name}.krea_negative", krea.get("negative_prompt")),
+9
View File
@@ -4806,6 +4806,15 @@ def smoke_sdxl_tag_routes() -> None:
_expect("27-year-old adult" in stale_character_route_tags, "SDXL route lost structured character age")
_expect("warm olive skin" in stale_character_route_tags, "SDXL route lost structured character skin")
_expect("stale" not in stale_character_route_tags, "SDXL route should not parse stale prompt character labels")
composition_label_row = _fixture_hardcore_row(
composition="coworking lounge frame with tall-window depth behind them composition",
)
composition_label_tags = sdxl_tag_routes.row_core_tags_result(
sdxl_tag_routes.SDXLRowTagRequest(composition_label_row, 1.29),
deps,
).as_text()
_expect("tall-window depth behind them composition" not in composition_label_tags, "SDXL route kept raw composition label tag")
_expect("tall-window depth behind them" in composition_label_tags, "SDXL route lost composition detail while removing label")
stale_prompt_row = _fixture_hardcore_row(
prompt="stale raw prompt mentions fully nude naked pussy penis oral anal semen penetration",
item="standing portrait setup",