aboutsummaryrefslogtreecommitdiffstats
path: root/modules/safe.py
diff options
context:
space:
mode:
authorMalumaDev <piano.lu92@gmail.com>2022-10-15 14:20:17 +0000
committerGitHub <noreply@github.com>2022-10-15 14:20:17 +0000
commit7b7561f6e4be3b591d845f14743bac2069e6428e (patch)
treef7ef27ffad7017c0d3cbd9b7a899c4308339885d /modules/safe.py
parent37d7ffb415cd8c69b3c0bb5f61844dde0b169f78 (diff)
parentd3ffc962dd1d5c8d0ed763a9d05832c153ff15ea (diff)
downloadstable-diffusion-webui-gfx803-7b7561f6e4be3b591d845f14743bac2069e6428e.tar.gz
stable-diffusion-webui-gfx803-7b7561f6e4be3b591d845f14743bac2069e6428e.tar.bz2
stable-diffusion-webui-gfx803-7b7561f6e4be3b591d845f14743bac2069e6428e.zip
Merge branch 'master' into test_resolve_conflicts
Diffstat (limited to 'modules/safe.py')
-rw-r--r--modules/safe.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/safe.py b/modules/safe.py
index 20be16a5..399165a1 100644
--- a/modules/safe.py
+++ b/modules/safe.py
@@ -96,11 +96,18 @@ def load(filename, *args, **kwargs):
if not shared.cmd_opts.disable_safe_unpickle:
check_pt(filename)
+ except pickle.UnpicklingError:
+ print(f"Error verifying pickled file from {filename}:", file=sys.stderr)
+ print(traceback.format_exc(), file=sys.stderr)
+ print(f"-----> !!!! The file is most likely corrupted !!!! <-----", file=sys.stderr)
+ print(f"You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.\n\n", file=sys.stderr)
+ return None
+
except Exception:
print(f"Error verifying pickled file from {filename}:", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)
print(f"\nThe file may be malicious, so the program is not going to read it.", file=sys.stderr)
- print(f"You can skip this check with --disable-safe-unpickle commandline argument.", file=sys.stderr)
+ print(f"You can skip this check with --disable-safe-unpickle commandline argument.\n\n", file=sys.stderr)
return None
return unsafe_torch_load(filename, *args, **kwargs)