Skip to content

Commit 4492e3a

Browse files
[Bug] Dynamo Unsupported due to BasevLLMParameter.torch_function calling disabled super() (#25613)
Signed-off-by: yewentao256 <zhyanwentao@126.com> Signed-off-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 05c1948 commit 4492e3a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

vllm/model_executor/parameter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from vllm.distributed import (get_tensor_model_parallel_rank,
1313
get_tensor_model_parallel_world_size)
1414
from vllm.logger import init_logger
15+
from vllm.utils import is_torch_equal_or_newer
1516

1617
__all__ = [
1718
"BasevLLMParameter", "PackedvLLMParameter", "PerTensorScaleParameter",
@@ -114,6 +115,15 @@ def _shard_id_as_int(self, shard_id: Union[str, int]) -> int:
114115

115116
@classmethod
116117
def __torch_function__(cls, func, types, args=(), kwargs=None):
118+
if not is_torch_equal_or_newer("2.8.0"):
119+
logger.warning_once(
120+
"Torch %s detected (<2.8.0): returning NotImplemented in "
121+
"BasevLLMParameter.__torch_function__ to avoid potential "
122+
"TorchDynamo issues.",
123+
torch.__version__,
124+
)
125+
return NotImplemented
126+
117127
if kwargs is None:
118128
kwargs = {}
119129
return super().__torch_function__(func, types, args, kwargs)

0 commit comments

Comments
 (0)