Fix loading diffusers format VAEs (#2171)

This commit is contained in:
catboxanon
2024-10-24 14:27:57 -04:00
committed by GitHub
parent 9a698e26d6
commit edeb2b883f

View File

@@ -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()):
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.')
return model
if component_name.startswith('text_encoder') and cls_name in ['CLIPTextModel', 'CLIPTextModelWithProjection']: