mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-04-30 03:01:15 +00:00
Fix loading diffusers format VAEs (#2171)
This commit is contained in:
@@ -53,6 +53,8 @@ def load_huggingface_component(guess, component_name, lib_name, cls_name, repo_p
|
|||||||
with using_forge_operations(device=memory_management.cpu, dtype=memory_management.vae_dtype()):
|
with using_forge_operations(device=memory_management.cpu, dtype=memory_management.vae_dtype()):
|
||||||
model = IntegratedAutoencoderKL.from_config(config)
|
model = IntegratedAutoencoderKL.from_config(config)
|
||||||
|
|
||||||
|
if 'decoder.up_blocks.0.resnets.0.norm1.weight' in state_dict.keys(): #diffusers format
|
||||||
|
state_dict = huggingface_guess.diffusers_convert.convert_vae_state_dict(state_dict)
|
||||||
load_state_dict(model, state_dict, ignore_start='loss.')
|
load_state_dict(model, state_dict, ignore_start='loss.')
|
||||||
return model
|
return model
|
||||||
if component_name.startswith('text_encoder') and cls_name in ['CLIPTextModel', 'CLIPTextModelWithProjection']:
|
if component_name.startswith('text_encoder') and cls_name in ['CLIPTextModel', 'CLIPTextModelWithProjection']:
|
||||||
|
|||||||
Reference in New Issue
Block a user