Tighten H3 spatial fallback retries

This commit is contained in:
2026-09-04 08:27:54 +00:00
parent 9f0c546681
commit 027865b9ca
2 changed files with 19 additions and 20 deletions
+12 -15
View File
@@ -506,8 +506,8 @@ def _shrink_model_tile_param(param):
next_param = dict(param) next_param = dict(param)
mode = str(next_param.get("tile_size_mode") or "specific_size") mode = str(next_param.get("tile_size_mode") or "specific_size")
if mode == "rows_cols": if mode == "rows_cols":
rows = min(9, max(1, int(next_param.get("grid_rows", 2) or 2) + 1)) rows = min(16, max(1, int(next_param.get("grid_rows", 2) or 2) * 2))
cols = min(9, max(1, int(next_param.get("grid_cols", 2) or 2) + 1)) cols = min(16, max(1, int(next_param.get("grid_cols", 2) or 2) * 2))
if rows == int(next_param.get("grid_rows", 2) or 2) and cols == int(next_param.get("grid_cols", 2) or 2): if rows == int(next_param.get("grid_rows", 2) or 2) and cols == int(next_param.get("grid_cols", 2) or 2):
return None return None
next_param["grid_rows"] = rows next_param["grid_rows"] = rows
@@ -524,21 +524,18 @@ def _shrink_model_tile_param(param):
if tile_w <= 0 or tile_h <= 0: if tile_w <= 0 or tile_h <= 0:
return None return None
# Jump straight from a coarse specific-size tile to a conservative 2x2 # Jump straight from a coarse specific-size tile to a conservative 4x4
# equal-grid split. That usually cuts peak VRAM much harder than halving # equal-grid split. That usually cuts peak VRAM much harder than halving
# the tile size through several retries. # the tile size through several retries, and it keeps the later retry
# ladder simple: 4x4 -> 8x8 -> 16x16.
next_param["tile_size_mode"] = "rows_cols" next_param["tile_size_mode"] = "rows_cols"
next_param["grid_rows"] = 2 next_param["grid_rows"] = 4
next_param["grid_cols"] = 2 next_param["grid_cols"] = 4
next_param["spatial_w_overlap"] = _halve_32(next_param.get("overlap", 0)) next_param["spatial_w_overlap"] = 0
next_param["spatial_h_overlap"] = _halve_32(next_param.get("overlap", 0)) next_param["spatial_h_overlap"] = 0
next_param["fade_width"] = _halve_32(next_param.get("fade_width", 0)) next_param["fade_width"] = 0
next_param["fade_height"] = _halve_32(next_param.get("fade_height", 0)) next_param["fade_height"] = 0
next_param["min_tile_size"] = min( next_param["min_tile_size"] = 32
_halve_32(next_param.get("min_tile_size", 0)),
max(32, _halve_32(tile_w)),
max(32, _halve_32(tile_h)),
)
return next_param return next_param
+7 -5
View File
@@ -1173,11 +1173,13 @@ class DumasH3LongVideosHelperTests(unittest.TestCase):
}) })
self.assertIsNotNone(smaller) self.assertIsNotNone(smaller)
self.assertEqual(smaller["tile_size_mode"], "rows_cols") self.assertEqual(smaller["tile_size_mode"], "rows_cols")
self.assertEqual(smaller["grid_rows"], 2) self.assertEqual(smaller["grid_rows"], 4)
self.assertEqual(smaller["grid_cols"], 2) self.assertEqual(smaller["grid_cols"], 4)
self.assertEqual(smaller["fade_width"] % 32, 0) self.assertEqual(smaller["spatial_w_overlap"], 0)
self.assertEqual(smaller["fade_height"] % 32, 0) self.assertEqual(smaller["spatial_h_overlap"], 0)
self.assertGreaterEqual(smaller["min_tile_size"], 0) self.assertEqual(smaller["fade_width"], 0)
self.assertEqual(smaller["fade_height"], 0)
self.assertEqual(smaller["min_tile_size"], 32)
def test_temporal_segments_split_long_sequences(self): def test_temporal_segments_split_long_sequences(self):
latent = importlib.import_module("dumas_h3_latent_upscale") latent = importlib.import_module("dumas_h3_latent_upscale")