From 5ad8c9a40b77f726a146bb9fb2766828b43257e2 Mon Sep 17 00:00:00 2001 From: "Wang, Yi A" Date: Sun, 12 Jan 2025 22:47:23 -0800 Subject: [PATCH] Baichuan2-13B does not have max_position_embeddings in config see https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat/blob/main/config.json Signed-off-by: Wang, Yi A --- server/text_generation_server/models/flash_causal_lm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/text_generation_server/models/flash_causal_lm.py b/server/text_generation_server/models/flash_causal_lm.py index 19fda9f1..4f8d37c1 100644 --- a/server/text_generation_server/models/flash_causal_lm.py +++ b/server/text_generation_server/models/flash_causal_lm.py @@ -1595,7 +1595,11 @@ class FlashCausalLM(Model): if max_total_tokens is None: if get_support_chunking(): model_max_length = self.tokenizer.model_max_length - max_position_embeddings = self.config.max_position_embeddings + max_position_embeddings = ( + self.config.max_position_embeddings + if hasattr(self.config, "max_position_embeddings") + else model_max_length + ) max_total_tokens = min( num_blocks * BLOCK_SIZE, model_max_length, max_position_embeddings )