support n param for hf

This commit is contained in:
Krrish Dholakia 2023-10-03 07:10:05 -07:00
parent cd2c1dff2d
commit 512769e841
5 changed files with 5 additions and 5 deletions

View file

@ -1039,7 +1039,7 @@ def get_optional_params( # use the openai defaults
optional_params["stop_sequences"] = stop
elif custom_llm_provider == "huggingface":
## check if unsupported param passed in
supported_params = ["stream", "temperature", "max_tokens", "top_p", "stop",]
supported_params = ["stream", "temperature", "max_tokens", "top_p", "stop", "n"]
_check_valid_arg(supported_params=supported_params)
if temperature:
@ -1055,6 +1055,8 @@ def get_optional_params( # use the openai defaults
optional_params["stop"] = stop
if max_tokens:
optional_params["max_new_tokens"] = max_tokens
if n:
optional_params["best_of"] = n
if presence_penalty:
optional_params["repetition_penalty"] = presence_penalty
elif custom_llm_provider == "together_ai":