mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-07-21 21:01:24 +08:00
wan
This commit is contained in:
parent
0989cc040b
commit
9cd96dc7e7
@ -92,6 +92,13 @@ class Wan(ForgeDiffusionEngine):
|
||||
end_image = self.end_image.movedim(1, -1)
|
||||
_, h, w, _ = end_image.shape
|
||||
|
||||
if self.start_image is not None and self.end_image is not None:
|
||||
memory_management.logger.info("[Wan] FirstLastFrameToVideo")
|
||||
elif self.start_image is not None and self.end_image is None:
|
||||
memory_management.logger.info("[Wan] ImageToVideo")
|
||||
elif self.start_image is None and self.end_image is not None:
|
||||
memory_management.logger.info("[Wan] LastFrameToVideo")
|
||||
|
||||
image = torch.ones((length, h, w, 3), device="cpu", dtype=torch.float32).mul(0.5)
|
||||
mask = torch.ones((1, 1, latent_shape[2] * 4, latent_shape[-2], latent_shape[-1]), device="cpu", dtype=torch.float32)
|
||||
|
||||
|
||||
@ -329,7 +329,14 @@ def forge_model_reload():
|
||||
|
||||
timer = Timer()
|
||||
|
||||
_last_frame: torch.Tensor = None
|
||||
# maintain the end_image so that FirstLastFrame is not broken
|
||||
# when reloading Wan 2.2 models via Refiner
|
||||
|
||||
if model_data.sd_model is not None:
|
||||
if getattr(model_data.sd_model, "end_image", None) is not None:
|
||||
_last_frame = model_data.sd_model.end_image.clone()
|
||||
|
||||
model_data.sd_model = None
|
||||
model_data.forge_hash = ""
|
||||
memory_management.unload_all_models()
|
||||
@ -370,6 +377,9 @@ def forge_model_reload():
|
||||
sd_model.sd_model_hash = checkpoint_info.calculate_shorthash()
|
||||
timer.record("calculate hash")
|
||||
|
||||
if _last_frame is not None:
|
||||
setattr(sd_model, "end_image", _last_frame)
|
||||
|
||||
shared.opts.data["sd_checkpoint_hash"] = checkpoint_info.sha256
|
||||
model_data.set_sd_model(sd_model)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user