mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-06 15:15:05 +08:00
fix for torch 1.12.1 loading saved file from torch 1.11
This commit is contained in:
parent
d5dfbc45a6
commit
6970696789
2
webui.py
2
webui.py
@ -730,6 +730,8 @@ class StableDiffusionModelHijack:
|
|||||||
|
|
||||||
data = torch.load(path)
|
data = torch.load(path)
|
||||||
param_dict = data['string_to_param']
|
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'
|
assert len(param_dict) == 1, 'embedding file has multiple terms in it'
|
||||||
emb = next(iter(param_dict.items()))[1].reshape(768)
|
emb = next(iter(param_dict.items()))[1].reshape(768)
|
||||||
self.word_embeddings[name] = emb
|
self.word_embeddings[name] = emb
|
||||||
|
Loading…
Reference in New Issue
Block a user