aboutsummaryrefslogtreecommitdiffstats
path: root/modules/safe.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-05-17 06:26:26 +0000
committerGitHub <noreply@github.com>2023-05-17 06:26:26 +0000
commit85232a5b26666854deae59cf950f744740dd5c37 (patch)
tree3af76d8c6ba3173ffd925336d902da058df4e02d /modules/safe.py
parent56a2672831751480f94a018f861f0143a8234ae8 (diff)
parent4b07f2f584596604c4499efb0b0295e96985080f (diff)
downloadstable-diffusion-webui-gfx803-85232a5b26666854deae59cf950f744740dd5c37.tar.gz
stable-diffusion-webui-gfx803-85232a5b26666854deae59cf950f744740dd5c37.tar.bz2
stable-diffusion-webui-gfx803-85232a5b26666854deae59cf950f744740dd5c37.zip
Merge branch 'dev' into taesd-a
Diffstat (limited to 'modules/safe.py')
-rw-r--r--modules/safe.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/safe.py b/modules/safe.py
index e6c2f2c0..e8f50774 100644
--- a/modules/safe.py
+++ b/modules/safe.py
@@ -40,7 +40,7 @@ class RestrictedUnpickler(pickle.Unpickler):
return getattr(collections, name)
if module == 'torch._utils' and name in ['_rebuild_tensor_v2', '_rebuild_parameter', '_rebuild_device_tensor_from_numpy']:
return getattr(torch._utils, name)
- if module == 'torch' and name in ['FloatStorage', 'HalfStorage', 'IntStorage', 'LongStorage', 'DoubleStorage', 'ByteStorage', 'float32']:
+ if module == 'torch' and name in ['FloatStorage', 'HalfStorage', 'IntStorage', 'LongStorage', 'DoubleStorage', 'ByteStorage', 'float32', 'BFloat16Storage']:
return getattr(torch, name)
if module == 'torch.nn.modules.container' and name in ['ParameterDict']:
return getattr(torch.nn.modules.container, name)
@@ -95,16 +95,16 @@ def check_pt(filename, extra_handler):
except zipfile.BadZipfile:
- # if it's not a zip file, it's an olf pytorch format, with five objects written to pickle
+ # if it's not a zip file, it's an old pytorch format, with five objects written to pickle
with open(filename, "rb") as file:
unpickler = RestrictedUnpickler(file)
unpickler.extra_handler = extra_handler
- for i in range(5):
+ for _ in range(5):
unpickler.load()
def load(filename, *args, **kwargs):
- return load_with_extra(filename, extra_handler=global_extra_handler, *args, **kwargs)
+ return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
def load_with_extra(filename, extra_handler=None, *args, **kwargs):