Add Inkling model support (#31681)
Co-authored-by: Chunan Zeng <zcnrex@gmail.com> Co-authored-by: Ke Bao <ispobaoke@gmail.com> Co-authored-by: Yanbin Jiang <jybsuper@gmail.com> Co-authored-by: Yuhao Yang <47235274+yhyang201@users.noreply.github.com> Co-authored-by: Qiaolin Yu <qiaolin.yu@radixark.ai> Co-authored-by: Zhichen Zeng <zczeng@uw.edu> Co-authored-by: Aurick Qiao <aurick@thinkingmachines.ai> Co-authored-by: Joseph <jk@thinkingmachines.ai>
This commit is contained in:
co-authored by
Chunan Zeng
Ke Bao
Yanbin Jiang
Yuhao Yang
Qiaolin Yu
Zhichen Zeng
Aurick Qiao
Joseph
parent
829e9ce9d5
commit
02236fa38c
@@ -20,6 +20,7 @@ from sglang.srt.utils.hf_transformers.common import (
|
||||
_is_deepseek_ocr_model,
|
||||
_override_v_head_dim_if_zero,
|
||||
_patch_text_config,
|
||||
attach_additional_stop_token_ids,
|
||||
check_gguf_file,
|
||||
get_context_length,
|
||||
get_hf_text_config,
|
||||
@@ -451,6 +452,37 @@ class TestGetHfTextConfig(unittest.TestCase):
|
||||
self.assertEqual(cfg.rope_scaling["type"], "llama3")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# attach_additional_stop_token_ids
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestAttachAdditionalStopTokenIds(unittest.TestCase):
|
||||
"""Bug regression: the Inkling bundle ships eos metadata unset while its
|
||||
turn-final marker <|content_model_end_sampling|> sits in added_tokens; the
|
||||
old detector only recognized <|eom_id|>, so generation ran to max length
|
||||
(documented by the Inkling GSM8K test)."""
|
||||
|
||||
@staticmethod
|
||||
def _tokenizer(added):
|
||||
return SimpleNamespace(get_added_vocab=lambda: added)
|
||||
|
||||
def test_inkling_end_sampling_registers_as_stop(self):
|
||||
tok = self._tokenizer({"<|content_model_end_sampling|>": 200006})
|
||||
attach_additional_stop_token_ids(tok)
|
||||
self.assertEqual(tok.additional_stop_token_ids, {200006})
|
||||
|
||||
def test_eom_id_still_registers_as_stop(self):
|
||||
tok = self._tokenizer({"<|eom_id|>": 128008})
|
||||
attach_additional_stop_token_ids(tok)
|
||||
self.assertEqual(tok.additional_stop_token_ids, {128008})
|
||||
|
||||
def test_no_known_marker_yields_none(self):
|
||||
tok = self._tokenizer({"<|other|>": 7})
|
||||
attach_additional_stop_token_ids(tok)
|
||||
self.assertIsNone(tok.additional_stop_token_ids)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _fix_special_tokens_pattern
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user