From 4b20a920d38ec84b8ca11ce262aa178e5279701d Mon Sep 17 00:00:00 2001 From: Alex Hedges Date: Thu, 23 Jun 2022 23:24:47 -0400 Subject: [PATCH] Check for bf16 support only if CUDA is available --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e281b189a256..2e92a847a75d 100755 --- a/setup.py +++ b/setup.py @@ -235,7 +235,7 @@ def create_dir_symlink(src, dest): nccl_version = ".".join(str(torch.cuda.nccl.version())[:2]) else: nccl_version = ".".join(map(str, torch.cuda.nccl.version()[:2])) - if hasattr(torch.cuda, 'is_bf16_supported'): + if hasattr(torch.cuda, 'is_bf16_supported') and torch.cuda.is_available(): bf16_support = torch.cuda.is_bf16_supported() if torch_available and hasattr(torch.version, 'hip') and torch.version.hip is not None: hip_version = ".".join(torch.version.hip.split('.')[:2])