Commit 69706967 authored by AUTOMATIC's avatar AUTOMATIC

fix for torch 1.12.1 loading saved file from torch 1.11

parent d5dfbc45
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment