mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 01:30:20 +01:00
Better separate the FlexGen case
This commit is contained in:
parent
0e16c0bacb
commit
72d539dbff
@ -201,12 +201,8 @@ def generate_reply(question, max_new_tokens, do_sample, temperature, top_p, typi
|
|||||||
reply = original_question + apply_extensions(reply[len(question):], "output")
|
reply = original_question + apply_extensions(reply[len(question):], "output")
|
||||||
yield formatted_outputs(reply, shared.model_name)
|
yield formatted_outputs(reply, shared.model_name)
|
||||||
|
|
||||||
if not shared.args.flexgen:
|
if output[-1] == n:
|
||||||
if output[-1] == n:
|
break
|
||||||
break
|
|
||||||
else:
|
|
||||||
if np.count_nonzero(input_ids[0] == n) < np.count_nonzero(output == n):
|
|
||||||
break
|
|
||||||
|
|
||||||
# Stream the output naively for FlexGen since it doesn't support 'stopping_criteria'
|
# Stream the output naively for FlexGen since it doesn't support 'stopping_criteria'
|
||||||
else:
|
else:
|
||||||
@ -223,14 +219,9 @@ def generate_reply(question, max_new_tokens, do_sample, temperature, top_p, typi
|
|||||||
reply = original_question + apply_extensions(reply[len(question):], "output")
|
reply = original_question + apply_extensions(reply[len(question):], "output")
|
||||||
yield formatted_outputs(reply, shared.model_name)
|
yield formatted_outputs(reply, shared.model_name)
|
||||||
|
|
||||||
if not shared.args.flexgen:
|
if np.count_nonzero(input_ids[0] == n) < np.count_nonzero(output == n):
|
||||||
if output[-1] == n:
|
break
|
||||||
break
|
input_ids = np.reshape(output, (1, output.shape[0]))
|
||||||
input_ids = torch.reshape(output, (1, output.shape[0]))
|
|
||||||
else:
|
|
||||||
if np.count_nonzero(input_ids[0] == n) < np.count_nonzero(output == n):
|
|
||||||
break
|
|
||||||
input_ids = np.reshape(output, (1, output.shape[0]))
|
|
||||||
|
|
||||||
if shared.soft_prompt:
|
if shared.soft_prompt:
|
||||||
inputs_embeds, filler_input_ids = generate_softprompt_input_tensors(input_ids)
|
inputs_embeds, filler_input_ids = generate_softprompt_input_tensors(input_ids)
|
||||||
|
Loading…
Reference in New Issue
Block a user