[Bugfix]: do not shutdown server if skip_special_use=False for MistralTokenizer (#14094)
Signed-off-by: Guillaume Calmettes <gcalmettes@scaleway.com>
This commit is contained in:
committed by
GitHub
parent
1e44ffc3ff
commit
1da6a09274
@@ -39,7 +39,8 @@ from vllm.sampling_params import BeamSearchParams, SamplingParams
|
|||||||
from vllm.sequence import Logprob
|
from vllm.sequence import Logprob
|
||||||
from vllm.transformers_utils.tokenizer import AnyTokenizer, MistralTokenizer
|
from vllm.transformers_utils.tokenizer import AnyTokenizer, MistralTokenizer
|
||||||
from vllm.transformers_utils.tokenizers import (maybe_serialize_tool_calls,
|
from vllm.transformers_utils.tokenizers import (maybe_serialize_tool_calls,
|
||||||
truncate_tool_call_ids)
|
truncate_tool_call_ids,
|
||||||
|
validate_request_params)
|
||||||
|
|
||||||
logger = init_logger(__name__)
|
logger = init_logger(__name__)
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ class OpenAIServingChat(OpenAIServing):
|
|||||||
# for more info: see comment in `maybe_serialize_tool_calls`
|
# for more info: see comment in `maybe_serialize_tool_calls`
|
||||||
maybe_serialize_tool_calls(request)
|
maybe_serialize_tool_calls(request)
|
||||||
truncate_tool_call_ids(request)
|
truncate_tool_call_ids(request)
|
||||||
|
validate_request_params(request)
|
||||||
|
|
||||||
if (request.tool_choice == "auto" and
|
if (request.tool_choice == "auto" and
|
||||||
not (self.enable_auto_tools and tool_parser is not None)
|
not (self.enable_auto_tools and tool_parser is not None)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
from .mistral import (MistralTokenizer, maybe_serialize_tool_calls,
|
from .mistral import (MistralTokenizer, maybe_serialize_tool_calls,
|
||||||
truncate_tool_call_ids)
|
truncate_tool_call_ids, validate_request_params)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"MistralTokenizer", "maybe_serialize_tool_calls", "truncate_tool_call_ids"
|
"MistralTokenizer", "maybe_serialize_tool_calls", "truncate_tool_call_ids",
|
||||||
|
"validate_request_params"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -98,6 +98,13 @@ def truncate_tool_call_ids(request: "ChatCompletionRequest"):
|
|||||||
request.messages[i]["tool_call_id"] = tool_call_id
|
request.messages[i]["tool_call_id"] = tool_call_id
|
||||||
|
|
||||||
|
|
||||||
|
def validate_request_params(request: "ChatCompletionRequest"):
|
||||||
|
if (request.skip_special_tokens is not None
|
||||||
|
and not request.skip_special_tokens):
|
||||||
|
raise ValueError("skip_special_tokens=False is not supported "
|
||||||
|
"for Mistral tokenizers.")
|
||||||
|
|
||||||
|
|
||||||
def list_local_repo_files(repo_id: str, revision: Optional[str]) -> List[str]:
|
def list_local_repo_files(repo_id: str, revision: Optional[str]) -> List[str]:
|
||||||
repo_cache = os.path.join(
|
repo_cache = os.path.join(
|
||||||
huggingface_hub.constants.HF_HUB_CACHE,
|
huggingface_hub.constants.HF_HUB_CACHE,
|
||||||
|
|||||||
Reference in New Issue
Block a user