Skip to content

Commit

Permalink
Sampling: Fix dynatemp defaults
Browse files Browse the repository at this point in the history
Default max temp and min temp is 1.0

Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Feb 8, 2024
1 parent 29cb98d commit 52ebc98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions backends/exllamav2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ def generate_gen(self, prompt: str, **kwargs):
gen_settings.mirostat = unwrap(kwargs.get("mirostat"), False)

# DynaTemp settings
max_temp = unwrap(kwargs.get("max_temp"), 0.0)
min_temp = unwrap(kwargs.get("min_temp"), 0.0)
max_temp = unwrap(kwargs.get("max_temp"), 1.0)
min_temp = unwrap(kwargs.get("min_temp"), 1.0)

if max_temp > min_temp:
gen_settings.max_temp = max_temp
Expand All @@ -553,7 +553,7 @@ def generate_gen(self, prompt: str, **kwargs):
# Warn if max/min temp values are > 0
# and if they're less than or equal to each other
if max_temp < min_temp or (
0 not in {min_temp, max_temp} and max_temp == min_temp
1 not in {min_temp, max_temp} and max_temp == min_temp
):
logger.warning(
"Max temp is less than or equal to min temp, skipping DynaTemp."
Expand Down
4 changes: 2 additions & 2 deletions common/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ class BaseSamplerRequest(BaseModel):
)

max_temp: Optional[float] = Field(
default_factory=lambda: get_default_sampler_value("max_temp", 0.0),
default_factory=lambda: get_default_sampler_value("max_temp", 1.0),
validation_alias=AliasChoices("max_temp", "dynatemp_high"),
description="Aliases: dynatemp_high",
)

min_temp: Optional[float] = Field(
default_factory=lambda: get_default_sampler_value("min_temp", 0.0),
default_factory=lambda: get_default_sampler_value("min_temp", 1.0),
validation_alias=AliasChoices("min_temp", "dynatemp_low"),
description="Aliases: dynatemp_low",
)
Expand Down

0 comments on commit 52ebc98

Please sign in to comment.