Offload H3 before latent upscale

This commit is contained in:
2026-09-04 09:49:34 +00:00
parent fbfbe4ef5a
commit cbabcf8208
2 changed files with 21 additions and 7 deletions
+3 -3
View File
@@ -6662,6 +6662,9 @@ class H3LongVideos:
parts = _nested_tensor_parts(out_samples)
if not getattr(out_samples, "is_nested", False) or len(parts) < 2:
raise RuntimeError("latent upscale expects a nested AV latent")
if latent_upscale_mode == "model" and str(latent_upscale_param.get("device", "cuda")) == "cuda" and hasattr(model, "clone_base_uuid"):
mm.unload_model_and_clones(model, unload_additional_models=False)
mm.soft_empty_cache()
upscaled_video, up_h, up_w = _upscale_latent_video(parts[0], latent_upscale_param)
full_audio = parts[1]
# Drop the first-pass sampling state before we start the refinement
@@ -6674,9 +6677,6 @@ class H3LongVideos:
target_h = int(up_h) * 16
if target_w <= 0 or target_h <= 0:
raise RuntimeError("latent upscale target size must be positive")
if latent_upscale_mode == "model" and str(latent_upscale_param.get("device", "cuda")) == "cuda" and hasattr(model, "clone_base_uuid"):
mm.unload_model_and_clones(model, unload_additional_models=False)
mm.soft_empty_cache()
upscale_cond, upscale_latent = _build_shot_conditioning(
clip, vae, prompt, target_w, target_h, ln, fps, handoff,
ref_images=refs, ref_image_size=ref_image_size,