[Bugfix] Format kernel-import errors eagerly so warning_once does not retain them (#54098)
Signed-off-by: Zeyu Wang <zwang86@users.noreply.github.com> Co-authored-by: Zeyu Wang <zwang86@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Zeyu Wang
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
38ca7a899c
commit
b6ce714354
@@ -605,26 +605,30 @@ class CpuPlatform(Platform):
|
|||||||
try:
|
try:
|
||||||
import vllm._C # noqa: F401
|
import vllm._C # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.warning_once("Failed to import from vllm._C: %r", e)
|
logger.warning_once(
|
||||||
|
"Failed to import from vllm._C: %s", repr(e)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
import vllm._C_AVX512 # noqa: F401
|
import vllm._C_AVX512 # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
if ignored_msg not in e.msg:
|
if ignored_msg not in e.msg:
|
||||||
logger.warning_once(
|
logger.warning_once(
|
||||||
"Failed to import from vllm._C_AVX512: %r", e
|
"Failed to import from vllm._C_AVX512: %s", repr(e)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
import vllm._C_AVX2 # noqa: F401
|
import vllm._C_AVX2 # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
if ignored_msg not in e.msg:
|
if ignored_msg not in e.msg:
|
||||||
logger.warning_once("Failed to import from vllm._C_AVX2: %r", e)
|
logger.warning_once(
|
||||||
|
"Failed to import from vllm._C_AVX2: %s", repr(e)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
import vllm._C # noqa: F401
|
import vllm._C # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.warning_once("Failed to import from vllm._C: %r", e)
|
logger.warning_once("Failed to import from vllm._C: %s", repr(e))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def pack_kv_cache(
|
def pack_kv_cache(
|
||||||
|
|||||||
@@ -239,7 +239,9 @@ class CudaPlatformBase(Platform):
|
|||||||
try:
|
try:
|
||||||
import vllm._C_stable_libtorch # noqa: F401
|
import vllm._C_stable_libtorch # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.warning_once("Failed to import from vllm._C_stable_libtorch: %r", e)
|
logger.warning_once(
|
||||||
|
"Failed to import from vllm._C_stable_libtorch: %s", repr(e)
|
||||||
|
)
|
||||||
with contextlib.suppress(ImportError):
|
with contextlib.suppress(ImportError):
|
||||||
import vllm._moe_C_stable_libtorch # noqa: F401
|
import vllm._moe_C_stable_libtorch # noqa: F401
|
||||||
with contextlib.suppress(ImportError):
|
with contextlib.suppress(ImportError):
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ class Platform:
|
|||||||
try:
|
try:
|
||||||
import vllm._C # noqa: F401
|
import vllm._C # noqa: F401
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.warning_once("Failed to import from vllm._C: %r", e)
|
logger.warning_once("Failed to import from vllm._C: %s", repr(e))
|
||||||
with contextlib.suppress(ImportError):
|
with contextlib.suppress(ImportError):
|
||||||
import vllm._moe_C_stable_libtorch # noqa: F401
|
import vllm._moe_C_stable_libtorch # noqa: F401
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user