Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrilvallez committed Sep 20, 2024
1 parent f7635ee commit 4f51ad4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
ImageGPTForCausalImageModeling,
SpeechEncoderDecoderModel,
)
from transformers.cache_utils import DynamicCache, EncoderDecoderCache, QuantoQuantizedCache, StaticCache
from transformers.cache_utils import DynamicCache, DynamicSlidingWindowCache, EncoderDecoderCache, QuantoQuantizedCache, StaticCache
from transformers.generation import (
BeamSampleDecoderOnlyOutput,
BeamSampleEncoderDecoderOutput,
Expand Down Expand Up @@ -1840,6 +1840,9 @@ def test_new_cache_format(self, num_beams, do_sample):
if config.is_encoder_decoder:
cache_cls = EncoderDecoderCache
past_key_values = cache_cls(DynamicCache(), DynamicCache())
elif getattr(self.config, "sliding_window", None) is not None:
cache_cls = DynamicSlidingWindowCache
past_key_values = cache_cls(self.config.sliding_window)
else:
cache_cls = DynamicCache
past_key_values = cache_cls()
Expand Down

0 comments on commit 4f51ad4

Please sign in to comment.