mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
Merge pull request #5173 from gitravin/rn/sagemaker-zero-temp
Allow zero temperature for Sagemaker models based on config
This commit is contained in:
commit
15334cfae3
1 changed files with 3 additions and 1 deletions
|
@ -3223,6 +3223,7 @@ def get_optional_params(
|
||||||
if temperature == 0.0 or temperature == 0:
|
if temperature == 0.0 or temperature == 0:
|
||||||
# hugging face exception raised when temp==0
|
# hugging face exception raised when temp==0
|
||||||
# Failed: Error occurred: HuggingfaceException - Input validation error: `temperature` must be strictly positive
|
# Failed: Error occurred: HuggingfaceException - Input validation error: `temperature` must be strictly positive
|
||||||
|
if not passed_params.get("aws_sagemaker_allow_zero_temp", False):
|
||||||
temperature = 0.01
|
temperature = 0.01
|
||||||
optional_params["temperature"] = temperature
|
optional_params["temperature"] = temperature
|
||||||
if top_p is not None:
|
if top_p is not None:
|
||||||
|
@ -3242,6 +3243,7 @@ def get_optional_params(
|
||||||
if max_tokens == 0:
|
if max_tokens == 0:
|
||||||
max_tokens = 1
|
max_tokens = 1
|
||||||
optional_params["max_new_tokens"] = max_tokens
|
optional_params["max_new_tokens"] = max_tokens
|
||||||
|
passed_params.pop("aws_sagemaker_allow_zero_temp", None)
|
||||||
elif custom_llm_provider == "bedrock":
|
elif custom_llm_provider == "bedrock":
|
||||||
supported_params = get_supported_openai_params(
|
supported_params = get_supported_openai_params(
|
||||||
model=model, custom_llm_provider=custom_llm_provider
|
model=model, custom_llm_provider=custom_llm_provider
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue