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
kingbri1 committed Dec 25, 2023
1 parent 7b74cb2 commit dfaf30b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions OAI/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CommonCompletionRequest(BaseModel):

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

Expand All @@ -91,6 +91,8 @@ def to_gen_params(self):
if isinstance(self.stop, str):
self.stop = [self.stop]

print(self.repetition_range)

return {
"stop": self.stop,
"max_tokens": self.max_tokens,
Expand All @@ -109,7 +111,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 dfaf30b

Please sign in to comment.