Retry long videos decode with tiling fallback
This commit is contained in:
+23
-10
@@ -6372,16 +6372,29 @@ class H3LongVideos:
|
||||
e._h3_stage = "sampling"
|
||||
raise
|
||||
refined_out = _video_only_refined_latent(out, refined_out)
|
||||
# Keep a CPU copy of the sampled latent BEFORE decoding, for the `latent`
|
||||
# output. Latents are ~1000x smaller than the frames they decode to (a
|
||||
# 1344x768 124f shot is ~1.5MB against ~1.5GB), so carrying one per shot for
|
||||
# the whole chain is free. Detached and moved off the card immediately, for
|
||||
# the same reason the decoded frames are.
|
||||
decode_video_start = time.perf_counter()
|
||||
shot_latent = _copy_sample_latent(refined_out)
|
||||
video = _decode_video(vae, refined_out, tiled, free_first=model,
|
||||
tile_t=decode_tile_frames, tile_xy=decode_tile_size)
|
||||
timing["decode_video"] += time.perf_counter() - decode_video_start
|
||||
# Keep a CPU copy of the sampled latent BEFORE decoding, for the `latent`
|
||||
# output. Latents are ~1000x smaller than the frames they decode to (a
|
||||
# 1344x768 124f shot is ~1.5MB against ~1.5GB), so carrying one per shot for
|
||||
# the whole chain is free. Detached and moved off the card immediately, for
|
||||
# the same reason the decoded frames are.
|
||||
decode_video_start = time.perf_counter()
|
||||
shot_latent = _copy_sample_latent(refined_out)
|
||||
try:
|
||||
video = _decode_video(vae, refined_out, tiled, free_first=model,
|
||||
tile_t=decode_tile_frames, tile_xy=decode_tile_size)
|
||||
except Exception as e:
|
||||
# Decode is the biggest allocation in the run. If the straight path
|
||||
# fails, retry once with tiled decode and without the aggressive unload
|
||||
# so a marginal card can still finish the render.
|
||||
if not _is_oom(e) and "decode" not in str(e).lower():
|
||||
raise
|
||||
mm.soft_empty_cache(True)
|
||||
retry_tiled = True
|
||||
retry_tile_t = decode_tile_frames or 16
|
||||
retry_tile_xy = decode_tile_size or 256
|
||||
video = _decode_video(vae, refined_out, retry_tiled, free_first=None,
|
||||
tile_t=retry_tile_t, tile_xy=retry_tile_xy)
|
||||
timing["decode_video"] += time.perf_counter() - decode_video_start
|
||||
decode_audio_start = time.perf_counter()
|
||||
audio = _decode_audio(audio_vae, out)
|
||||
timing["decode_audio"] += time.perf_counter() - decode_audio_start
|
||||
|
||||
Reference in New Issue
Block a user