Support stop_token_ids in sglang API (#1092)
This commit is contained in:
@@ -235,10 +235,12 @@ class Req:
|
||||
return
|
||||
|
||||
last_token_id = self.output_ids[-1]
|
||||
if self.tokenizer is None:
|
||||
matched_eos = last_token_id in self.sampling_params.stop_token_ids
|
||||
else:
|
||||
matched_eos = last_token_id == self.tokenizer.eos_token_id
|
||||
|
||||
matched_eos = last_token_id in self.sampling_params.stop_token_ids
|
||||
|
||||
if self.tokenizer is not None:
|
||||
matched_eos |= last_token_id == self.tokenizer.eos_token_id
|
||||
|
||||
if matched_eos and not self.sampling_params.ignore_eos:
|
||||
self.finished_reason = FINISH_MATCHED_TOKEN(matched=last_token_id)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user