Stop generation immediately when using "Maximum tokens/second" (#3952)

---------

Co-authored-by: oobabooga <112222186+oobabooga@users.noreply.github.com>
This commit is contained in:
BadisG 2023-09-18 19:27:06 +02:00 committed by GitHub
parent b7c55665c1
commit 893a72a1c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,7 +96,7 @@ def _generate_reply(question, state, stopping_strings=None, is_chat=False, escap
last_update = cur_time
yield reply
if stop_found:
if stop_found or (state['max_tokens_second'] > 0 and shared.stop_everything):
break
if not is_chat: