From f2d3646cfaa74f4a785d90f7c058822ca1de5d29 Mon Sep 17 00:00:00 2001 From: Miroslav Goncharenko Date: Tue, 26 Nov 2024 18:40:03 +0100 Subject: [PATCH] text_generation: improve parameters check (#1527) --- optimum/habana/transformers/generation/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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