fix hf gen args

This commit is contained in:
hiyouga 2024-05-19 19:39:32 +08:00
parent 8ee8ac6eba
commit 70214b71b1
1 changed files with 3 additions and 0 deletions

View File

@ -97,6 +97,9 @@ class HuggingfaceEngine(BaseEngine):
if isinstance(num_return_sequences, int) and num_return_sequences > 1:
generating_args["do_sample"] = True
if not generating_args["temperature"]:
generating_args["do_sample"] = False
if not generating_args["do_sample"]:
generating_args.pop("temperature", None)
generating_args.pop("top_p", None)