LLM: fix inconsistency between output token number and max_new_token (#8479)

This commit is contained in:
binbin Deng 2023-07-07 17:31:05 +08:00 committed by GitHub
parent bcc1eae322
commit d489775d2c

View file

@ -164,7 +164,7 @@ class GenerationMixin:
res_list = []
word_count = 0
for token in tokens:
if word_count > max_new_tokens:
if word_count >= max_new_tokens:
break
res_list.append(token)
word_count += 1