Skip to content

Commit

Permalink
Merge pull request #12 from chtanch/fix-decode-error
Browse files Browse the repository at this point in the history
Fix token decode error
  • Loading branch information
sgwhat committed Feb 22, 2024
2 parents 6f8c858 + 76ea855 commit c82384d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/text_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def get_reply_from_output_ids(output_ids, state, starting_from=0):
if (hasattr(shared.tokenizer, 'convert_ids_to_tokens') and len(output_ids) > starting_from) and not reply.startswith(' '):
first_token = shared.tokenizer.convert_ids_to_tokens(int(output_ids[starting_from]))
if isinstance(first_token, (bytes,)):
first_token = first_token.decode('utf8')
first_token = first_token.decode('utf8', errors='ignore')

if first_token.startswith('▁'):
reply = ' ' + reply
Expand Down

0 comments on commit c82384d

Please sign in to comment.