From a577fb1077ebbf2631276c5fc408fe4aff93d208 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 16 Mar 2023 00:46:59 -0300 Subject: [PATCH] Keep GALACTICA special tokens (#300) --- modules/text_generation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/text_generation.py b/modules/text_generation.py index a29b987f..e5b4ad91 100644 --- a/modules/text_generation.py +++ b/modules/text_generation.py @@ -38,7 +38,7 @@ def encode(prompt, tokens_to_generate=0, add_special_tokens=True): def decode(output_ids): # Open Assistant relies on special tokens like <|endoftext|> - if re.match('oasst-*', shared.model_name.lower()): + if re.match('(oasst|galactica)-*', shared.model_name.lower()): return shared.tokenizer.decode(output_ids, skip_special_tokens=False) else: reply = shared.tokenizer.decode(output_ids, skip_special_tokens=True)