Skip to content

Commit

Permalink
add allowed_token_ids check
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzaijun committed Oct 30, 2024
1 parent acd5a51 commit 0109f12
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lightllm/server/router/model_infer/infer_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def __init__(
self.regex_guide = None
self.fsm_current_state: int = 0
self.allowed_token_ids = allowed_token_ids
# this check is not very good to placed here. to do...
if self.allowed_token_ids is not None:
if not all(e < vocab_size for e in self.allowed_token_ids):
logger.error("allowed_token_ids contain tokenid >= vobsize, we remove these token ids")
self.allowed_token_ids = [e for e in self.allowed_token_ids if e < vocab_size]
return

def has_constraint_setting(self) -> bool:
Expand Down

0 comments on commit 0109f12

Please sign in to comment.