mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-29 02:31:48 +00:00
Model: Fix logit bias handling
If the token doesn't exist, gracefully warn instead of erroring out. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -750,7 +750,13 @@ class ExllamaV2Container:
|
|||||||
|
|
||||||
# Map logits to the tensor with their biases
|
# Map logits to the tensor with their biases
|
||||||
for token, bias in logit_bias.items():
|
for token, bias in logit_bias.items():
|
||||||
gen_settings.token_bias[token] = bias
|
if token in gen_settings.token_bias:
|
||||||
|
gen_settings.token_bias[token] = bias
|
||||||
|
else:
|
||||||
|
logger.warning(
|
||||||
|
f"Logit bias: Token {token} not present "
|
||||||
|
"in the model's vocab. Skipping."
|
||||||
|
)
|
||||||
|
|
||||||
# Ban the EOS token if specified. If not, append to stop conditions
|
# Ban the EOS token if specified. If not, append to stop conditions
|
||||||
# as well.
|
# as well.
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class BaseSamplerRequest(BaseModel):
|
|||||||
|
|
||||||
logit_bias: Optional[Dict[int, float]] = Field(
|
logit_bias: Optional[Dict[int, float]] = Field(
|
||||||
default_factory=lambda: get_default_sampler_value("logit_bias"),
|
default_factory=lambda: get_default_sampler_value("logit_bias"),
|
||||||
examples=[[{"1": 10}]],
|
examples=[{"1": 10, "2": 50}],
|
||||||
)
|
)
|
||||||
|
|
||||||
negative_prompt: Optional[str] = Field(
|
negative_prompt: Optional[str] = Field(
|
||||||
|
|||||||
Reference in New Issue
Block a user