diff --git a/tests/generation/test_utils.py b/tests/generation/test_utils.py index 3af5cbebf7024b..16568e91a35aaa 100644 --- a/tests/generation/test_utils.py +++ b/tests/generation/test_utils.py @@ -1879,7 +1879,10 @@ def test_new_cache_format(self, num_beams, do_sample): ) new_cache = new_results.past_key_values - legacy_cache_converted = cache_cls.from_legacy_cache(legacy_results.past_key_values) + if cache_cls == DynamicSlidingWindowCache: + legacy_cache_converted = cache_cls.from_legacy_cache(config.sliding_window, legacy_results.past_key_values) + else: + legacy_cache_converted = cache_cls.from_legacy_cache(legacy_results.past_key_values) for layer_idx in range(len(new_cache)): for kv_idx in range(len(new_cache[layer_idx])): self.assertTrue(