From cca9d6e22d6cb3e2909121f6d6077af36b2116f5 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:21:06 -0700 Subject: [PATCH] Lint --- modules/text_generation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/text_generation.py b/modules/text_generation.py index 654eff89..86245098 100644 --- a/modules/text_generation.py +++ b/modules/text_generation.py @@ -274,10 +274,10 @@ def get_reply_from_output_ids(output_ids, state=None, 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,)): - #try to decode the bytes to a string + # try to decode the bytes to a string + # if it fails, which means it's not a string in this turn, just ignore it try: first_token = first_token.decode('utf8') - #if it fails, which means it's not a string in this turn, just ignore it except UnicodeDecodeError: first_token = ''