Skip to content

Commit

Permalink
fix an error that prevents running webui on torch<2.0 without --disab…
Browse files Browse the repository at this point in the history
…le-safe-unpickle
  • Loading branch information
AUTOMATIC1111 committed May 2, 2023
1 parent 72cd27a commit 5ab7f21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 5 additions & 1 deletion modules/safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5ab7f21

Please sign in to comment.