Handle unlimited tokenizer context lengths (#37054)
Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
This commit is contained in:
co-authored by
Baizhou Zhang
parent
f60bc73c58
commit
032fe91bf1
@@ -45,6 +45,11 @@ class OpenAIServingTokenize(OpenAIServingBase):
|
||||
try:
|
||||
tokenizer = self.tokenizer_manager.tokenizer
|
||||
max_model_len = getattr(tokenizer, "model_max_length", -1)
|
||||
# ORJSON accepts signed negative and unsigned positive 64-bit integers.
|
||||
if isinstance(max_model_len, int) and not (
|
||||
-(2**63) <= max_model_len < 2**64
|
||||
):
|
||||
max_model_len = self.tokenizer_manager.model_config.context_len
|
||||
|
||||
if request.messages is not None:
|
||||
token_ids = self._tokenize_chat_request(request)
|
||||
|
||||
Reference in New Issue
Block a user