Fix radial attention cache not resetting on resolution change, add more robust supported dimension check

This commit is contained in:
kijai
2025-07-20 12:15:01 +03:00
parent 9f75b7e051
commit 768a4b2d90
3 changed files with 30 additions and 6 deletions
+8
View File
@@ -261,3 +261,11 @@ def optimized_scale(positive_flat, negative_flat):
st_star = dot_product / squared_norm
return st_star
def find_closest_valid_dim(fixed_dim, var_dim, block_size):
for delta in range(1, 17):
for sign in [-1, 1]:
candidate = var_dim + sign * delta
if candidate > 0 and ((fixed_dim * candidate) // 4) % block_size == 0:
return candidate
return var_dim