Add top_p

This commit is contained in:
oobabooga 2023-03-01 16:45:48 -03:00
parent 7c4d5ca8cc
commit 831ac7ed3f

View File

@ -86,11 +86,11 @@ def generate_reply(question, max_new_tokens, do_sample, temperature, top_p, typi
if shared.is_RWKV:
if shared.args.no_stream:
reply = shared.model.generate(question, token_count=max_new_tokens, temperature=temperature)
reply = shared.model.generate(question, token_count=max_new_tokens, temperature=temperature, top_p=top_p)
yield formatted_outputs(reply, None)
else:
for i in range(max_new_tokens//8):
reply = shared.model.generate(question, token_count=8, temperature=temperature)
reply = shared.model.generate(question, token_count=8, temperature=temperature, top_p=top_p)
yield formatted_outputs(reply, None)
question = reply
return formatted_outputs(reply, None)