Переглянути джерело

Merge pull request #11824 from AUTOMATIC1111/XYZ-always_discard_next_to_last_sigma

XYZ always_discard_next_to_last_sigma
AUTOMATIC1111 2 роки тому
батько
коміт
f97e35929b
1 змінених файлів з 11 додано та 1 видалено
  1. 11 1
      scripts/xyz_grid.py

+ 11 - 1
scripts/xyz_grid.py

@@ -144,11 +144,20 @@ def apply_face_restore(p, opt, x):
     p.restore_faces = is_active
     p.restore_faces = is_active
 
 
 
 
-def apply_override(field):
+def apply_override(field, boolean: bool = False):
     def fun(p, x, xs):
     def fun(p, x, xs):
+        if boolean:
+            x = True if x.lower() == "true" else False
         p.override_settings[field] = x
         p.override_settings[field] = x
     return fun
     return fun
 
 
+
+def boolean_choice(reverse: bool = False):
+    def choice():
+        return ["False", "True"] if reverse else ["True", "False"]
+    return choice
+
+
 def format_value_add_label(p, opt, x):
 def format_value_add_label(p, opt, x):
     if type(x) == float:
     if type(x) == float:
         x = round(x, 8)
         x = round(x, 8)
@@ -235,6 +244,7 @@ axis_options = [
     AxisOption("Face restore", str, apply_face_restore, format_value=format_value),
     AxisOption("Face restore", str, apply_face_restore, format_value=format_value),
     AxisOption("Token merging ratio", float, apply_override('token_merging_ratio')),
     AxisOption("Token merging ratio", float, apply_override('token_merging_ratio')),
     AxisOption("Token merging ratio high-res", float, apply_override('token_merging_ratio_hr')),
     AxisOption("Token merging ratio high-res", float, apply_override('token_merging_ratio_hr')),
+    AxisOption("Always discard next-to-last sigma", str, apply_override('always_discard_next_to_last_sigma', boolean=True), choices=boolean_choice(reverse=True)),
 ]
 ]