Skip to content

Commit 729ac9c

Browse files
committed
add try block and fix linting
Signed-off-by: ignaciosica <[email protected]>
1 parent ae3b4f3 commit 729ac9c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

vllm/platforms/cpu.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ def supported_dtypes(self) -> list[torch.dtype]:
7676
if self.get_cpu_architecture() == CpuArchEnum.POWERPC:
7777
return [torch.bfloat16, torch.float32]
7878
elif (self.get_cpu_architecture() == CpuArchEnum.ARM
79-
and sys.platform.startswith("darwin")):
80-
if (subprocess.check_output(
81-
["sysctl", "-n", "-e", "hw.optional.arm.FEAT_BF16"]
82-
).strip() == b"1"):
83-
return [torch.bfloat16, torch.float16, torch.float32]
84-
return [torch.float16, torch.float32]
79+
and sys.platform.startswith("darwin")):
80+
try:
81+
if (subprocess.check_output(
82+
["sysctl", "-n", "-i",
83+
"hw.optional.arm.FEAT_BF16"]).strip() == b"1"):
84+
return [torch.bfloat16, torch.float16, torch.float32]
85+
except Exception:
86+
return [torch.float16, torch.float32]
8587
# x86/aarch64 CPU has supported both bf16 and fp16 natively.
8688
return [torch.bfloat16, torch.float16, torch.float32]
8789

0 commit comments

Comments
 (0)