aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-02 01:31:01 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-02 01:31:01 +0300
commit6970696789a2edad2f7470c462b73cf86aead166 (patch)
treef5dac8869a40daa9b270ae9a0f7a4407b57d5a24
parentd5dfbc45a6056fa066e0b5b57f6c1d6a4c7a87b1 (diff)
fix for torch 1.12.1 loading saved file from torch 1.11
-rw-r--r--webui.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/webui.py b/webui.py
index 49002a2a..ad38323e 100644
--- a/webui.py
+++ b/webui.py
@@ -730,6 +730,8 @@ class StableDiffusionModelHijack:
data = torch.load(path)
param_dict = data['string_to_param']
+ if hasattr(param_dict, '_parameters'):
+ param_dict = getattr(param_dict, '_parameters') # fix for torch 1.12.1 loading saved file from torch 1.11
assert len(param_dict) == 1, 'embedding file has multiple terms in it'
emb = next(iter(param_dict.items()))[1].reshape(768)
self.word_embeddings[name] = emb