mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 11:12:35 +00:00
fix for torch 1.12.1 loading saved file from torch 1.11
This commit is contained in:
2
webui.py
2
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
|
||||
|
Reference in New Issue
Block a user