Prioritize temporal fallback for latent upscale OOM
This commit is contained in:
@@ -72,6 +72,10 @@ def _is_oom_error(exc):
|
||||
return "out of memory" in text or "exhausted its gpu spatial fallbacks" in text
|
||||
|
||||
|
||||
def _should_retry_temporal_before_spatial(param):
|
||||
return _uses_cuda_model_upscale(param) and int(param.get("chunk_length", 0) or 0) > CUDA_MODEL_CHUNK_LENGTH
|
||||
|
||||
|
||||
def _retry_with_smaller_temporal(video, param, upscaler, exc):
|
||||
if not _is_oom_error(exc):
|
||||
raise exc
|
||||
@@ -665,6 +669,11 @@ def upscale_video_model(video, param):
|
||||
except RuntimeError as exc:
|
||||
if "out of memory" not in str(exc).lower():
|
||||
raise
|
||||
if _should_retry_temporal_before_spatial(param):
|
||||
raise RuntimeError(
|
||||
"out of memory: retry H3 latent upscale with a smaller temporal chunk "
|
||||
"before spatial fallback"
|
||||
) from exc
|
||||
smaller = _shrink_model_tile_param(param)
|
||||
if smaller is None:
|
||||
raise RuntimeError(
|
||||
|
||||
Reference in New Issue
Block a user