mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-25 22:08:53 +01:00
Text Generation: stop if EOS token is reached (#4213)
This commit is contained in:
parent
7743b5e9de
commit
98fa73a974
@ -353,10 +353,11 @@ def generate_reply_HF(question, original_question, seed, state, stopping_strings
|
||||
|
||||
with generate_with_streaming(**generate_params) as generator:
|
||||
for output in generator:
|
||||
yield get_reply_from_output_ids(output, input_ids, original_question, state, is_chat=is_chat)
|
||||
if output[-1] in eos_token_ids:
|
||||
break
|
||||
|
||||
yield get_reply_from_output_ids(output, input_ids, original_question, state, is_chat=is_chat)
|
||||
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
|
Loading…
Reference in New Issue
Block a user