Fix Open Assistant
This commit is contained in:
parent
1ddcd4d0ba
commit
b9e0712b92
1 changed files with 7 additions and 3 deletions
|
@ -37,6 +37,10 @@ def encode(prompt, tokens_to_generate=0, add_special_tokens=True):
|
||||||
return input_ids.cuda()
|
return input_ids.cuda()
|
||||||
|
|
||||||
def decode(output_ids):
|
def decode(output_ids):
|
||||||
|
# Open Assistant relies on special tokens like <|endoftext|>
|
||||||
|
if re.match('oasst-*', 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)
|
reply = shared.tokenizer.decode(output_ids, skip_special_tokens=True)
|
||||||
reply = reply.replace(r'<|endoftext|>', '')
|
reply = reply.replace(r'<|endoftext|>', '')
|
||||||
return reply
|
return reply
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue