Extend H3 spatial fallback ladder
This commit is contained in:
@@ -506,8 +506,8 @@ def _shrink_model_tile_param(param):
|
||||
next_param = dict(param)
|
||||
mode = str(next_param.get("tile_size_mode") or "specific_size")
|
||||
if mode == "rows_cols":
|
||||
rows = min(16, max(1, int(next_param.get("grid_rows", 2) or 2) * 2))
|
||||
cols = min(16, max(1, int(next_param.get("grid_cols", 2) or 2) * 2))
|
||||
rows = min(32, max(1, int(next_param.get("grid_rows", 2) or 2) * 2))
|
||||
cols = min(32, 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):
|
||||
return None
|
||||
next_param["grid_rows"] = rows
|
||||
@@ -527,7 +527,7 @@ def _shrink_model_tile_param(param):
|
||||
# Jump straight from a coarse specific-size tile to a conservative 4x4
|
||||
# equal-grid split. That usually cuts peak VRAM much harder than halving
|
||||
# the tile size through several retries, and it keeps the later retry
|
||||
# ladder simple: 4x4 -> 8x8 -> 16x16.
|
||||
# ladder simple: 4x4 -> 8x8 -> 16x16 -> 32x32.
|
||||
next_param["tile_size_mode"] = "rows_cols"
|
||||
next_param["grid_rows"] = 4
|
||||
next_param["grid_cols"] = 4
|
||||
|
||||
@@ -1202,6 +1202,22 @@ class DumasH3LongVideosHelperTests(unittest.TestCase):
|
||||
self.assertEqual(smaller["fade_height"], 0)
|
||||
self.assertEqual(smaller["min_tile_size"], 32)
|
||||
|
||||
def test_shrink_model_tile_param_rows_cols_can_reach_thirty_two(self):
|
||||
latent = importlib.import_module("dumas_h3_latent_upscale")
|
||||
smaller = latent._shrink_model_tile_param({
|
||||
"tile_size_mode": "rows_cols",
|
||||
"grid_rows": 16,
|
||||
"grid_cols": 16,
|
||||
"spatial_w_overlap": 0,
|
||||
"spatial_h_overlap": 0,
|
||||
"fade_width": 0,
|
||||
"fade_height": 0,
|
||||
"min_tile_size": 32,
|
||||
})
|
||||
self.assertIsNotNone(smaller)
|
||||
self.assertEqual(smaller["grid_rows"], 32)
|
||||
self.assertEqual(smaller["grid_cols"], 32)
|
||||
|
||||
def test_temporal_segments_split_long_sequences(self):
|
||||
latent = importlib.import_module("dumas_h3_latent_upscale")
|
||||
bounds = latent._temporal_segments(36, 85, 17)
|
||||
|
||||
Reference in New Issue
Block a user