Keep GALACTICA special tokens (#300)

This commit is contained in:
oobabooga 2023-03-16 00:46:59 -03:00
parent 25a00eaf98
commit a577fb1077

View File

@ -38,7 +38,7 @@ def encode(prompt, tokens_to_generate=0, add_special_tokens=True):
def decode(output_ids): def decode(output_ids):
# Open Assistant relies on special tokens like <|endoftext|> # 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) return shared.tokenizer.decode(output_ids, skip_special_tokens=False)
else: else:
reply = shared.tokenizer.decode(output_ids, skip_special_tokens=True) reply = shared.tokenizer.decode(output_ids, skip_special_tokens=True)