A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
Better errors for Transformers backend missing features (#23759)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Harry Mellor committed
Aug 29, 2025 at 08:01 UTC
934bebf19252da6e1f2583d92e31d583b49498a2
1 file changed
+23
-2
vllm/model_executor/models/transformers.py
+23
-2
@@ -17,6 +17,7 @@
17
"""Wrapper around `transformers` models"""
18
from collections.abc import Iterable, Mapping
19
from contextlib import contextmanager
20
+from pathlib import Path
21
from typing import Literal, Optional, Union
22
23
import regex as re
@@ -60,6 +61,21 @@ from .utils import (AutoWeightsLoader, PPMissingLayer, WeightsMapper,
61
logger = init_logger(__name__)
62
63
64
+def get_feature_request_tip(
65
+ model: str,
66
+ trust_remote_code: bool,
67
+) -> str:
68
+ hf_url = f"a discussion at https://huggingface.co/{model}/discussions/new"
69
+ gh_url = "an issue at https://github.com/huggingface/transformers/issues/new/choose"
70
+ url = hf_url if trust_remote_code else gh_url
71
+ prefix = f"Please open {url} to request support for this feature. "
72
+ if Path(model).exists():
73
+ prefix = ""
74
+ doc_url = "https://docs.vllm.ai/en/latest/models/supported_models.html#writing-custom-models"
75
+ tip = f"See {doc_url} for instructions on how to add support yourself."
76
+ return f"{prefix}{tip}"
77
+
78
+
79
def vllm_flash_attention_forward(
80
# Transformers args
81
module: torch.nn.Module,
@@ -480,8 +496,11 @@ class TransformersBase(nn.Module, SupportsQuant, SupportsLoRA, SupportsPP):
496
return
497
498
if not self.model.supports_pp_plan:
499
+ tip = get_feature_request_tip(self.model_config.model,
500
+ self.model_config.trust_remote_code)
501
raise ValueError(
484
- f"{type(self.model)} does not support pipeline parallel yet!")
502
+ f"{type(self.model)} does not support pipeline parallel. {tip}"
503
+ )
504
505
module_lists = []
506
module_list_idx = None
@@ -535,8 +554,10 @@ class TransformersBase(nn.Module, SupportsQuant, SupportsLoRA, SupportsPP):
554
models_with_tp_plan = filter(supports_tp_plan, pretrained_models)
555
556
if not any(models_with_tp_plan) and self.tp_size > 1:
557
+ tip = get_feature_request_tip(self.model_config.model,
558
+ self.model_config.trust_remote_code)
559
raise ValueError(
539
- f"{type(self.model)} does not support tensor parallel yet!")
560
+ f"{type(self.model)} does not support tensor parallel. {tip}")
561
562
def _tensor_parallel(module: nn.Module,
563
prefix: str = "",