diff --git a/optimum/habana/transformers/generation/utils.py b/optimum/habana/transformers/generation/utils.py index 012fcccfd1..2bbe3e17e2 100644 --- a/optimum/habana/transformers/generation/utils.py +++ b/optimum/habana/transformers/generation/utils.py @@ -1062,9 +1062,10 @@ def generate( ) if model_kwargs["reduce_recompile"]: assert generation_config.bucket_size - # Below condition checked explicitly since llama supports bucket_internal even without reuse_cache + # Below condition checked explicitly since some models (like llama and gpt_bigcode) support bucket_internal even without reuse_cache if generation_config.bucket_internal: assert generation_config.bucket_size >= 0, "please set bucket_size to use bucket_internal" + assert generation_config.use_cache, "please set use_cache flag to use bucket_internal" if generation_config.reuse_cache: assert ( self.config.model_type