This commit is contained in:
lllyasviel
2024-01-24 11:03:36 -08:00
parent 89ac02a80f
commit 4e5ba653c6
2 changed files with 7 additions and 2 deletions

View File

@@ -653,6 +653,12 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None):
timer.record("create unet patcher")
del state_dict_for_forge
def patched_decode_first_stage(sample):
sample = unet_patcher.model.model_config.latent_format.process_out(sample)
return vae_patcher.decode(sample).movedim(-1, 1) * 2.0 - 1.0
sd_model.decode_first_stage = patched_decode_first_stage
load_model_weights(sd_model, checkpoint_info, state_dict_for_a1111, timer)
del state_dict_for_a1111
timer.record("load weights from state dict")

View File

@@ -52,8 +52,7 @@ def samples_to_images_tensor(sample, approximation=None, model=None):
else:
if model is None:
model = shared.sd_model
sample = model.unet_patcher.model.model_config.latent_format.process_out(sample)
x_sample = model.vae_patcher.decode(sample).movedim(-1, 1) * 2.0 - 1.0
x_sample = model.decode_first_stage(sample)
return x_sample