Filter incompatible SDXL route tags
This commit is contained in:
@@ -52,6 +52,14 @@ HARDCORE_NOISE_TERMS = (
|
||||
"the scene contains",
|
||||
)
|
||||
|
||||
INCOMPATIBLE_SDXL_TAGS = {
|
||||
"penetration": ("oral sex", "outercourse", "anal sex", "manual stimulation"),
|
||||
"oral": ("penetrative sex", "penetration", "anal sex", "outercourse"),
|
||||
"outercourse": ("penetrative sex", "penetration", "oral sex", "anal sex"),
|
||||
"manual": ("penetrative sex", "penetration", "oral sex", "anal sex"),
|
||||
"anal": ("oral sex", "outercourse"),
|
||||
}
|
||||
|
||||
|
||||
def _json(value: Any) -> str:
|
||||
return json.dumps(value, ensure_ascii=True, sort_keys=True)
|
||||
@@ -235,7 +243,13 @@ def _text_issues(label: str, value: Any, *, min_len: int = 8) -> list[str]:
|
||||
return issues
|
||||
|
||||
|
||||
def _formatter_issues(name: str, formats: dict[str, Any], *, is_pov: bool = False) -> list[str]:
|
||||
def _formatter_issues(
|
||||
name: str,
|
||||
formats: dict[str, Any],
|
||||
*,
|
||||
row: dict[str, Any] | None = None,
|
||||
is_pov: bool = False,
|
||||
) -> list[str]:
|
||||
issues: list[str] = []
|
||||
krea = formats["krea"]
|
||||
sdxl = formats["sdxl"]
|
||||
@@ -274,6 +288,12 @@ def _formatter_issues(name: str, formats: dict[str, Any], *, is_pov: bool = Fals
|
||||
for noise in HARDCORE_NOISE_TERMS:
|
||||
if noise in lower_krea:
|
||||
issues.append(f"{name}.krea_prompt: hardcore_noise:{noise}")
|
||||
if isinstance(row, dict):
|
||||
family = str(row.get("action_family") or "").strip()
|
||||
sdxl_lower = f", {sdxl_prompt.lower()}, "
|
||||
for tag in INCOMPATIBLE_SDXL_TAGS.get(family, ()):
|
||||
if f", {tag}, " in sdxl_lower:
|
||||
issues.append(f"{name}.sdxl_prompt: incompatible_family_tag:{family}:{tag}")
|
||||
if is_pov:
|
||||
if "viewer" not in lower_krea or "first-person" not in lower_krea:
|
||||
issues.append(f"{name}.krea_prompt: pov_wording_missing")
|
||||
@@ -324,7 +344,7 @@ def _case_report(
|
||||
is_pov: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
formats = _format_metadata(metadata, target)
|
||||
issues = _formatter_issues(name, formats, is_pov=is_pov)
|
||||
issues = _formatter_issues(name, formats, row=metadata, is_pov=is_pov)
|
||||
issues.extend(_route_metadata_issues(name, metadata))
|
||||
if target == "softcore":
|
||||
issues.extend(_softcore_issues(f"{name}.krea_prompt", formats["krea"].get("krea_prompt")))
|
||||
@@ -354,11 +374,11 @@ def _pair_reports(name: str, pair: dict[str, Any], *, include_prompts: bool) ->
|
||||
hard_row = dict(pair.get("hardcore_row") or {})
|
||||
soft_formats = _format_metadata(pair, "softcore")
|
||||
hard_formats = _format_metadata(pair, "hardcore")
|
||||
soft_issues = _formatter_issues(f"{name}.softcore", soft_formats)
|
||||
soft_issues = _formatter_issues(f"{name}.softcore", soft_formats, row=soft_row)
|
||||
soft_issues.extend(_route_metadata_issues(f"{name}.softcore", soft_row))
|
||||
soft_issues.extend(_softcore_issues(f"{name}.softcore.krea_prompt", soft_formats["krea"].get("krea_prompt")))
|
||||
hard_is_pov = bool(hard_row.get("pov_character_labels"))
|
||||
hard_issues = _formatter_issues(f"{name}.hardcore", hard_formats, is_pov=hard_is_pov)
|
||||
hard_issues = _formatter_issues(f"{name}.hardcore", hard_formats, row=hard_row, is_pov=hard_is_pov)
|
||||
hard_issues.extend(_route_metadata_issues(f"{name}.hardcore", hard_row))
|
||||
reports = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user