Files
agentic-kvc/third_party/vllm/vllm/utils/mistral.py
Gahow Wang 445e491123 Add vLLM v0.18.1 source tree with KV transfer abort fix
third_party/vllm/ now tracked in git for direct patch management.
Based on vLLM v0.18.1 release with one patch applied:

  vllm/v1/core/sched/scheduler.py:
    Replace fatal assert with graceful skip when KV transfer callback
    arrives for an already-aborted request during PD disaggregated serving.

Future vLLM modifications should be made directly in third_party/vllm/
and committed normally. The patches/ directory is kept as documentation
of what changed from upstream.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 00:30:38 +08:00

29 lines
1.0 KiB
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Provides lazy import of the vllm.tokenizers.mistral module."""
from __future__ import annotations
from typing import TYPE_CHECKING, TypeGuard
from vllm.tokenizers import TokenizerLike
from vllm.utils.import_utils import LazyLoader
if TYPE_CHECKING:
# if type checking, eagerly import the module
import vllm.tokenizers.mistral as mt
else:
mt = LazyLoader("mt", globals(), "vllm.tokenizers.mistral")
def is_mistral_tokenizer(obj: TokenizerLike | None) -> TypeGuard[mt.MistralTokenizer]:
"""Return true if the tokenizer is a MistralTokenizer instance."""
cls = type(obj)
# Check for special class attribute, this avoids importing the class to
# do an isinstance() check. If the attribute is True, do an isinstance
# check to be sure we have the correct type.
return bool(
getattr(cls, "IS_MISTRAL_TOKENIZER", False)
and isinstance(obj, mt.MistralTokenizer)
)