From a26f39fd1022842fba9e6339fd6b8c53e80f77a7 Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Fri, 31 Jan 2025 15:53:06 +0000 Subject: [PATCH] [Moshi] disable automatic compilation if the model can't compile (#35992) moshi cant compile --- src/transformers/generation/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/generation/utils.py b/src/transformers/generation/utils.py index 9f613e8e9c2c..f0f7f2b0b6b5 100644 --- a/src/transformers/generation/utils.py +++ b/src/transformers/generation/utils.py @@ -3187,7 +3187,7 @@ def _sample( model_forward = self.__call__ if isinstance(model_kwargs.get("past_key_values"), Cache): - is_compileable = model_kwargs["past_key_values"].is_compileable + is_compileable = model_kwargs["past_key_values"].is_compileable and self._supports_static_cache if is_compileable and ( self.device.type == "cuda" or generation_config.compile_config._compile_all_devices ):