Update forge_loader.py

This commit is contained in:
lllyasviel
2024-01-25 13:47:47 -08:00
parent 1112a71697
commit 116f18ff5a

View File

@@ -232,10 +232,13 @@ def load_model_for_a1111(timer, checkpoint_info=None, state_dict=None):
def patched_encode_first_stage(x):
sample = forge_objects.vae.encode(x.movedim(1, -1) * 0.5 + 0.5)
sample = forge_objects.unet.model.model_config.latent_format.process_in(sample)
return sample.to(x)
sd_model.get_first_stage_encoding = lambda x: x
def patched_get_first_stage_encoding(x):
sample = forge_objects.unet.model.model_config.latent_format.process_in(x)
return sample.to(x)
sd_model.get_first_stage_encoding = patched_get_first_stage_encoding
sd_model.decode_first_stage = patched_decode_first_stage
sd_model.encode_first_stage = patched_encode_first_stage