aboutsummaryrefslogtreecommitdiffstats
path: root/modules/safe.py
diff options
context:
space:
mode:
authorpapuSpartan <30642826+papuSpartan@users.noreply.github.com>2023-05-03 07:21:50 +0000
committerpapuSpartan <30642826+papuSpartan@users.noreply.github.com>2023-05-03 07:21:50 +0000
commitf08ae961157d33051b5cd09ba5c77b779096ef69 (patch)
tree038e0f511d51816c0a971d6093da0420b5677ae0 /modules/safe.py
parentdff60e2e74964a8b02b75ecd8cf8007ef67a9712 (diff)
parent335428c2c8139dfe07ba096a6defa75036660244 (diff)
downloadstable-diffusion-webui-gfx803-f08ae961157d33051b5cd09ba5c77b779096ef69.tar.gz
stable-diffusion-webui-gfx803-f08ae961157d33051b5cd09ba5c77b779096ef69.tar.bz2
stable-diffusion-webui-gfx803-f08ae961157d33051b5cd09ba5c77b779096ef69.zip
resolve merge conflicts and swap to dev branch for now
Diffstat (limited to 'modules/safe.py')
-rw-r--r--modules/safe.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/safe.py b/modules/safe.py
index 82d44be3..e6c2f2c0 100644
--- a/modules/safe.py
+++ b/modules/safe.py
@@ -1,6 +1,5 @@
# this code is adapted from the script contributed by anon from /h/
-import io
import pickle
import collections
import sys
@@ -12,11 +11,9 @@ import _codecs
import zipfile
import re
-
# PyTorch 1.13 and later have _TypedStorage renamed to TypedStorage
TypedStorage = torch.storage.TypedStorage if hasattr(torch.storage, 'TypedStorage') else torch.storage._TypedStorage
-
def encode(*args):
out = _codecs.encode(*args)
return out
@@ -27,7 +24,11 @@ class RestrictedUnpickler(pickle.Unpickler):
def persistent_load(self, saved_id):
assert saved_id[0] == 'storage'
- return TypedStorage()
+
+ try:
+ return TypedStorage(_internal=True)
+ except TypeError:
+ return TypedStorage() # PyTorch before 2.0 does not have the _internal argument
def find_class(self, module, name):
if self.extra_handler is not None: