fix an error that prevents running webui on torch<2.0 without --disable-safe-unpickle

This commit is contained in:
AUTOMATIC 2023-05-02 09:20:35 +03:00
parent 72cd27a135
commit 5ab7f213be
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,7 @@
## 1.1.1
### Bug Fixes:
* fix an error that prevents running webui on torch<2.0 without --disable-safe-unpickle
## 1.1.0
### Features:
* switch to torch 2.0.0 (except for AMD GPUs)

View File

@ -24,7 +24,11 @@ class RestrictedUnpickler(pickle.Unpickler):
def persistent_load(self, saved_id):
assert saved_id[0] == 'storage'
return TypedStorage(_internal=True)
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: