From c02bfb6c2836ef1f3acb6aaa9bc71feb29d09900 Mon Sep 17 00:00:00 2001 From: "serge[bot]" Date: Tue, 14 Jul 2026 01:00:34 +0000 Subject: [PATCH] [serge] Fix 10 integration tests for model `gemma3` failing with `output_mismatch` (list output differs (8), other (2)) --- src/transformers/generation/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transformers/generation/utils.py b/src/transformers/generation/utils.py index e95081871be2..6950109d55e3 100644 --- a/src/transformers/generation/utils.py +++ b/src/transformers/generation/utils.py @@ -1776,7 +1776,8 @@ def _prepare_generation_config( # `cache_implementation="hybrid"` (the static sliding window cache). For these models, we now want to use # the dynamic sliding window cache by default, so we UNSET `cache_implementation` if it is a default value. # (if we're inside this branch, then it is because we're using default values from the Hub) - if generation_config.cache_implementation == "hybrid": + # Only unset when the value comes from the model's default config, not when explicitly passed by the user. + if "cache_implementation" not in kwargs and generation_config.cache_implementation == "hybrid": generation_config.cache_implementation = None # It doesn't make sense to allow kwargs and `generation_config`, that should be mutually exclusive