From c954f21ac05642c416cbd87861ddebe9af2ae1b4 Mon Sep 17 00:00:00 2001 From: youkaichao Date: Thu, 19 Dec 2024 21:18:25 -0800 Subject: [PATCH] [misc] add early error message for custom ops (#11355) Signed-off-by: youkaichao --- vllm/utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vllm/utils.py b/vllm/utils.py index 3934903385ad4..1b90eca1cd6cc 100644 --- a/vllm/utils.py +++ b/vllm/utils.py @@ -1577,8 +1577,18 @@ def direct_register_custom_op( library object. If you want to bind the operator to a different library, make sure the library object is alive when the operator is used. """ - if is_in_doc_build() or not supports_custom_op(): + if is_in_doc_build(): return + + if not supports_custom_op(): + assert not current_platform.is_cuda_alike(), ( + "cuda platform needs torch>=2.4 to support custom op, " + "chances are you are using an old version of pytorch " + "or a custom build of pytorch. It is recommended to " + "use vLLM in a fresh new environment and let it install " + "the required dependencies.") + return + import torch.library if hasattr(torch.library, "infer_schema"): schema_str = torch.library.infer_schema(op_func,