Clean SDXL expression labels
This commit is contained in:
@@ -56,6 +56,7 @@ def split_tag_text(text: Any) -> list[str]:
|
|||||||
text = re.sub(r"\bMan [A-Z]'s\b", "man's", text)
|
text = re.sub(r"\bMan [A-Z]'s\b", "man's", text)
|
||||||
text = re.sub(r"\bWoman [A-Z]\b", "woman", text)
|
text = re.sub(r"\bWoman [A-Z]\b", "woman", text)
|
||||||
text = re.sub(r"\bMan [A-Z]\b", "man", text)
|
text = re.sub(r"\bMan [A-Z]\b", "man", text)
|
||||||
|
text = re.sub(r"\b(?:the\s+)?(?:woman|man)\s+has\s+", "", text, flags=re.IGNORECASE)
|
||||||
text = re.sub(
|
text = re.sub(
|
||||||
r"\b(?:Clothing state|Visual clothing state|visible remaining styling|teaser outfit detail|softcore visual reference|Sexual scene|Role graph):\s*",
|
r"\b(?:Clothing state|Visual clothing state|visible remaining styling|teaser outfit detail|softcore visual reference|Sexual scene|Role graph):\s*",
|
||||||
"",
|
"",
|
||||||
|
|||||||
@@ -576,6 +576,12 @@ def _sdxl_composition_tag_issues(name: str, sdxl_prompt: str) -> list[str]:
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def _sdxl_expression_label_issues(name: str, sdxl_prompt: str) -> list[str]:
|
||||||
|
if re.search(r"\b(?:woman|man)\s+has\s+", sdxl_prompt, flags=re.IGNORECASE):
|
||||||
|
return [f"{name}.sdxl_prompt: character_has_expression_label"]
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
def _trace_dict(formatter_name: str, payload: dict[str, Any]) -> tuple[dict[str, Any], str]:
|
def _trace_dict(formatter_name: str, payload: dict[str, Any]) -> tuple[dict[str, Any], str]:
|
||||||
trace_text = str(payload.get("route_trace_json") or "")
|
trace_text = str(payload.get("route_trace_json") or "")
|
||||||
if not trace_text:
|
if not trace_text:
|
||||||
@@ -713,6 +719,7 @@ def _formatter_issues(
|
|||||||
issues.extend(_krea_grammar_issues(name, krea_prompt))
|
issues.extend(_krea_grammar_issues(name, krea_prompt))
|
||||||
issues.extend(_composition_label_issues(name, prompts))
|
issues.extend(_composition_label_issues(name, prompts))
|
||||||
issues.extend(_sdxl_composition_tag_issues(name, sdxl_prompt))
|
issues.extend(_sdxl_composition_tag_issues(name, sdxl_prompt))
|
||||||
|
issues.extend(_sdxl_expression_label_issues(name, sdxl_prompt))
|
||||||
|
|
||||||
for label, value in (
|
for label, value in (
|
||||||
(f"{name}.krea_negative", krea.get("negative_prompt")),
|
(f"{name}.krea_negative", krea.get("negative_prompt")),
|
||||||
|
|||||||
@@ -4815,6 +4815,18 @@ def smoke_sdxl_tag_routes() -> None:
|
|||||||
).as_text()
|
).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 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")
|
_expect("tall-window depth behind them" in composition_label_tags, "SDXL route lost composition detail while removing label")
|
||||||
|
expression_label_row = _fixture_hardcore_row(
|
||||||
|
character_expression_text="Woman A has focused gaze; Man A has steady expression",
|
||||||
|
expression="stale expression",
|
||||||
|
)
|
||||||
|
expression_label_tags = sdxl_tag_routes.row_core_tags_result(
|
||||||
|
sdxl_tag_routes.SDXLRowTagRequest(expression_label_row, 1.29),
|
||||||
|
deps,
|
||||||
|
).as_text()
|
||||||
|
_expect("woman has" not in expression_label_tags.lower(), "SDXL route kept woman-has expression label")
|
||||||
|
_expect("man has" not in expression_label_tags.lower(), "SDXL route kept man-has expression label")
|
||||||
|
_expect("focused gaze" in expression_label_tags, "SDXL route lost cleaned woman expression")
|
||||||
|
_expect("steady expression" in expression_label_tags, "SDXL route lost cleaned man expression")
|
||||||
stale_prompt_row = _fixture_hardcore_row(
|
stale_prompt_row = _fixture_hardcore_row(
|
||||||
prompt="stale raw prompt mentions fully nude naked pussy penis oral anal semen penetration",
|
prompt="stale raw prompt mentions fully nude naked pussy penis oral anal semen penetration",
|
||||||
item="standing portrait setup",
|
item="standing portrait setup",
|
||||||
|
|||||||
Reference in New Issue
Block a user