mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-28 10:11:39 +00:00
API: Fix banned_tokens string when empty
The string should not be parsed and any non-string elements should be removed as well. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -249,11 +249,14 @@ class BaseSamplerRequest(BaseModel):
|
|||||||
self.validate_params()
|
self.validate_params()
|
||||||
|
|
||||||
# Convert stop to an array of strings
|
# Convert stop to an array of strings
|
||||||
if isinstance(self.stop, str):
|
if self.stop and isinstance(self.stop, str):
|
||||||
self.stop = [self.stop]
|
self.stop = [self.stop]
|
||||||
|
|
||||||
if isinstance(self.banned_tokens, str):
|
# Convert string banned tokens to an integer list
|
||||||
self.banned_tokens = list(map(int, self.banned_tokens.split(",")))
|
if self.banned_tokens and isinstance(self.banned_tokens, str):
|
||||||
|
self.banned_tokens = [
|
||||||
|
int(x) for x in self.banned_tokens.split(",") if x.isdigit()
|
||||||
|
]
|
||||||
|
|
||||||
gen_params = {
|
gen_params = {
|
||||||
"max_tokens": self.max_tokens,
|
"max_tokens": self.max_tokens,
|
||||||
|
|||||||
Reference in New Issue
Block a user