Skip to content

vllm.transformers_utils.chat_templates

Modules:

Name Description
registry

__all__ module-attribute

__all__ = ['get_chat_template_fallback_path']

get_chat_template_fallback_path

get_chat_template_fallback_path(
    model_type: str, tokenizer_name_or_path: str
) -> Optional[Path]
Source code in vllm/transformers_utils/chat_templates/registry.py
def get_chat_template_fallback_path(
    model_type: str,
    tokenizer_name_or_path: str,
) -> Optional[Path]:
    chat_template = _MODEL_TYPE_TO_CHAT_TEMPLATE_FALLBACK.get(model_type)
    if callable(chat_template):
        chat_template = chat_template(tokenizer_name_or_path)

    if chat_template is None:
        return None

    return chat_template