0001 - Avoid cache conversion

This commit is contained in:
ydshieh 2024-05-18 11:06:17 +02:00
parent 862cde4ce8
commit 468f7cca06
1 changed files with 4 additions and 0 deletions

View File

@ -1167,6 +1167,10 @@ class GemmaForCausalLM(GemmaPreTrainedModel):
_length=None,
**kwargs,
):
# TODO: Move this to `src/transformers/generation/utils.py`
if use_cache and past_key_values is None:
past_key_values = DynamicCache.from_legacy_cache(past_key_values)
past_length = 0
if past_key_values is not None:
if isinstance(past_key_values, Cache):