mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-06 06:29:21 -05:00
feat(generation): add support for eos_token_id (#714)
chore: add support for custom eos_token_id Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
@@ -454,6 +454,11 @@ class LLM(t.Generic[M, T], ReprMixin):
|
||||
|
||||
if stop_token_ids is None:
|
||||
stop_token_ids = []
|
||||
eos_token_id = attrs.get('eos_token_id', config['eos_token_id'])
|
||||
if eos_token_id is not None:
|
||||
if not isinstance(eos_token_id, list):
|
||||
eos_token_id = [eos_token_id]
|
||||
stop_token_ids.extend(eos_token_id)
|
||||
if self.tokenizer.eos_token_id not in stop_token_ids:
|
||||
stop_token_ids.append(self.tokenizer.eos_token_id)
|
||||
if stop is None:
|
||||
|
||||
Reference in New Issue
Block a user