From 6970696789a2edad2f7470c462b73cf86aead166 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Fri, 2 Sep 2022 01:31:01 +0300 Subject: fix for torch 1.12.1 loading saved file from torch 1.11 --- webui.py | 2 ++ 1 file changed, 2 insertions(+) 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 -- cgit v1.2.1