diff --git a/dumas_h3_latent_upscale.py b/dumas_h3_latent_upscale.py index 7adab6f..62ce047 100644 --- a/dumas_h3_latent_upscale.py +++ b/dumas_h3_latent_upscale.py @@ -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(9, max(1, int(next_param.get("grid_rows", 2) or 2) + 1)) - cols = min(9, max(1, int(next_param.get("grid_cols", 2) or 2) + 1)) + 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)) 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 @@ -524,21 +524,18 @@ def _shrink_model_tile_param(param): if tile_w <= 0 or tile_h <= 0: 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 - # 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["grid_rows"] = 2 - next_param["grid_cols"] = 2 - next_param["spatial_w_overlap"] = _halve_32(next_param.get("overlap", 0)) - next_param["spatial_h_overlap"] = _halve_32(next_param.get("overlap", 0)) - next_param["fade_width"] = _halve_32(next_param.get("fade_width", 0)) - next_param["fade_height"] = _halve_32(next_param.get("fade_height", 0)) - next_param["min_tile_size"] = min( - _halve_32(next_param.get("min_tile_size", 0)), - max(32, _halve_32(tile_w)), - max(32, _halve_32(tile_h)), - ) + next_param["grid_rows"] = 4 + next_param["grid_cols"] = 4 + next_param["spatial_w_overlap"] = 0 + next_param["spatial_h_overlap"] = 0 + next_param["fade_width"] = 0 + next_param["fade_height"] = 0 + next_param["min_tile_size"] = 32 return next_param diff --git a/tests/test_dumas_h3_longvideos.py b/tests/test_dumas_h3_longvideos.py index 17f083e..6ac5541 100644 --- a/tests/test_dumas_h3_longvideos.py +++ b/tests/test_dumas_h3_longvideos.py @@ -1173,11 +1173,13 @@ class DumasH3LongVideosHelperTests(unittest.TestCase): }) self.assertIsNotNone(smaller) self.assertEqual(smaller["tile_size_mode"], "rows_cols") - self.assertEqual(smaller["grid_rows"], 2) - self.assertEqual(smaller["grid_cols"], 2) - self.assertEqual(smaller["fade_width"] % 32, 0) - self.assertEqual(smaller["fade_height"] % 32, 0) - self.assertGreaterEqual(smaller["min_tile_size"], 0) + self.assertEqual(smaller["grid_rows"], 4) + self.assertEqual(smaller["grid_cols"], 4) + self.assertEqual(smaller["spatial_w_overlap"], 0) + self.assertEqual(smaller["spatial_h_overlap"], 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): latent = importlib.import_module("dumas_h3_latent_upscale")