mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +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:
|
with generate_with_streaming(**generate_params) as generator:
|
||||||
for output in 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:
|
if output[-1] in eos_token_ids:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
yield get_reply_from_output_ids(output, input_ids, original_question, state, is_chat=is_chat)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user