Răsfoiți Sursa

Merge pull request #11047 from AUTOMATIC1111/parse_generation_parameters_with_error

handles exception when parsing generation parameters from png info
AUTOMATIC1111 2 ani în urmă
părinte
comite
a009fe15fd
1 a modificat fișierele cu 12 adăugiri și 9 ștergeri
  1. 12 9
      modules/generation_parameters_copypaste.py

+ 12 - 9
modules/generation_parameters_copypaste.py

@@ -277,15 +277,18 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
     res["Negative prompt"] = negative_prompt
     res["Negative prompt"] = negative_prompt
 
 
     for k, v in re_param.findall(lastline):
     for k, v in re_param.findall(lastline):
-        if v[0] == '"' and v[-1] == '"':
-            v = unquote(v)
-
-        m = re_imagesize.match(v)
-        if m is not None:
-            res[f"{k}-1"] = m.group(1)
-            res[f"{k}-2"] = m.group(2)
-        else:
-            res[k] = v
+        try:
+            if v[0] == '"' and v[-1] == '"':
+                v = unquote(v)
+
+            m = re_imagesize.match(v)
+            if m is not None:
+                res[f"{k}-1"] = m.group(1)
+                res[f"{k}-2"] = m.group(2)
+            else:
+                res[k] = v
+        except Exception:
+            print(f"Error parsing \"{k}: {v}\"")
 
 
     # Missing CLIP skip means it was set to 1 (the default)
     # Missing CLIP skip means it was set to 1 (the default)
     if "Clip skip" not in res:
     if "Clip skip" not in res: