From 0adf2a7091f130578ceb81e31740fcf0b80d4ef2 Mon Sep 17 00:00:00 2001 From: Somdev Sangwan Date: Tue, 30 May 2023 22:58:39 +0530 Subject: [PATCH] fix cases where CUDA_VERSION is None --- run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 07fb06a..ed4f833 100644 --- a/run.py +++ b/run.py @@ -67,6 +67,8 @@ def pre_check(): CUDNN_VERSION = torch.backends.cudnn.version() if 'ROCMExecutionProvider' not in core.globals.providers: + if not torch.cuda.is_available() or not CUDA_VERSION: + quit("You are using --gpu flag but CUDA isn't available or properly installed on your system.") if CUDA_VERSION > '11.8': quit(f"CUDA version {CUDA_VERSION} is not supported - please downgrade to 11.8.") if CUDA_VERSION < '11.4': @@ -75,8 +77,6 @@ def pre_check(): quit(f"CUDNN version {CUDNN_VERSION} is not supported - please upgrade to 8.9.1") if CUDNN_VERSION > 8910: quit(f"CUDNN version {CUDNN_VERSION} is not supported - please downgrade to 8.9.1") - if not torch.cuda.is_available(): - quit("You are using --gpu flag but CUDA isn't available or properly installed on your system.") else: core.globals.providers = ['CPUExecutionProvider']