From d8e1ce669b717453d263662961d301d266ee775c Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Tue, 20 Dec 2022 15:24:42 +0100 Subject: [PATCH] Easiest fix. --- server/text_generation/models/causal_lm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/text_generation/models/causal_lm.py b/server/text_generation/models/causal_lm.py index aeecf127..6c567069 100644 --- a/server/text_generation/models/causal_lm.py +++ b/server/text_generation/models/causal_lm.py @@ -354,7 +354,8 @@ class CausalLM(Model): if stop: # Decode all tokens output_text = self.tokenizer.decode( - all_input_ids.squeeze(-1), skip_special_tokens=True + all_input_ids.squeeze(-1), skip_special_tokens=True, + cleanup_tokenization_spaces=False ) # Slice with input_length to remove padding token_ids = all_input_ids[-new_input_length:]