Skip to content

Commit

Permalink
OAI: Fix rep pen range alias
Browse files Browse the repository at this point in the history
No need to unwrap because the Pydantic alias does that for us.

Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Dec 25, 2023
1 parent 7b74cb2 commit e92ef8f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions OAI/types/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
""" Common types for OAI. """
from typing import List, Dict, Optional, Union

from pydantic import BaseModel, Field, AliasChoices

from utils import unwrap
from typing import List, Dict, Optional, Union


class LogProbs(BaseModel):
Expand Down Expand Up @@ -81,7 +78,7 @@ class CommonCompletionRequest(BaseModel):

# Aliased variables
repetition_range: Optional[int] = Field(
default=None,
default=-1,
validation_alias=AliasChoices("repetition_range", "repetition_penalty_range"),
)

Expand Down Expand Up @@ -109,7 +106,7 @@ def to_gen_params(self):
"frequency_penalty": self.frequency_penalty,
"presence_penalty": self.presence_penalty,
"repetition_penalty": self.repetition_penalty,
"repetition_range": unwrap(self.repetition_range, -1),
"repetition_range": self.repetition_range,
"repetition_decay": self.repetition_decay,
"mirostat": self.mirostat_mode == 2,
"mirostat_tau": self.mirostat_tau,
Expand Down

0 comments on commit e92ef8f

Please sign in to comment.