Reduce latent upscale VRAM pressure

This commit is contained in:
2026-09-04 07:21:38 +00:00
parent 782a7d658b
commit a34c9eb4ff
2 changed files with 6 additions and 31 deletions
+4 -27
View File
@@ -541,39 +541,14 @@ def _shrink_model_tile_param(param):
def _shrink_temporal_param(param): def _shrink_temporal_param(param):
def _lower_17(v):
v = int(v or 0)
if v <= 0:
return 0
v = (v // 2 // 17) * 17
return max(0, v)
next_param = dict(param) next_param = dict(param)
chunk_length = int(next_param.get("chunk_length", 0) or 0) chunk_length = int(next_param.get("chunk_length", 0) or 0)
temporal_overlap = int(next_param.get("temporal_overlap", 0) or 0) temporal_overlap = int(next_param.get("temporal_overlap", 0) or 0)
if chunk_length <= 17: if chunk_length <= 17:
return None return None
new_chunk_length = _lower_17(chunk_length) next_param["chunk_length"] = 17
if new_chunk_length < 17: next_param["temporal_overlap"] = 0
new_chunk_length = chunk_length - 17
if new_chunk_length < 17:
return None
if new_chunk_length >= chunk_length:
new_chunk_length = chunk_length - 17
if new_chunk_length < 17:
return None
new_overlap = min(_lower_17(temporal_overlap), max(0, new_chunk_length - 17))
if new_overlap >= new_chunk_length:
new_overlap = max(0, new_chunk_length - 17)
if new_overlap >= new_chunk_length:
new_overlap = 0
if new_overlap >= new_chunk_length:
return None
next_param["chunk_length"] = new_chunk_length
next_param["temporal_overlap"] = new_overlap
return next_param return next_param
@@ -746,6 +721,8 @@ def upscale_video_interp(video, param):
def _upscale_video_temporal_chunks(video, param, upscaler): def _upscale_video_temporal_chunks(video, param, upscaler):
if video.device.type != "cpu":
video = video.to(device="cpu", copy=True)
chunk_length = int(param.get("chunk_length", 0) or 0) chunk_length = int(param.get("chunk_length", 0) or 0)
temporal_overlap = int(param.get("temporal_overlap", 0) or 0) temporal_overlap = int(param.get("temporal_overlap", 0) or 0)
anchor_strength = float(param.get("anchor_strength", 0.999) or 0.999) anchor_strength = float(param.get("anchor_strength", 0.999) or 0.999)
+2 -4
View File
@@ -1193,10 +1193,8 @@ class DumasH3LongVideosHelperTests(unittest.TestCase):
"temporal_overlap": 17, "temporal_overlap": 17,
}) })
self.assertIsNotNone(smaller) self.assertIsNotNone(smaller)
self.assertLess(smaller["chunk_length"], 85) self.assertEqual(smaller["chunk_length"], 17)
self.assertLess(smaller["temporal_overlap"], 85) self.assertEqual(smaller["temporal_overlap"], 0)
self.assertEqual(smaller["chunk_length"] % 17, 0)
self.assertEqual(smaller["temporal_overlap"] % 17, 0)
def test_compose_persistent_does_not_expand_ambiguous_plural_to_full_cast(self): def test_compose_persistent_does_not_expand_ambiguous_plural_to_full_cast(self):
active = self.module.parse_wardrobe( active = self.module.parse_wardrobe(