fix cases where CUDA_VERSION is None

This commit is contained in:
Somdev Sangwan 2023-05-30 22:58:39 +05:30 committed by GitHub
parent 80fe3721ee
commit 0adf2a7091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
run.py
View File

@ -67,6 +67,8 @@ def pre_check():
CUDNN_VERSION = torch.backends.cudnn.version() CUDNN_VERSION = torch.backends.cudnn.version()
if 'ROCMExecutionProvider' not in core.globals.providers: 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': if CUDA_VERSION > '11.8':
quit(f"CUDA version {CUDA_VERSION} is not supported - please downgrade to 11.8.") quit(f"CUDA version {CUDA_VERSION} is not supported - please downgrade to 11.8.")
if CUDA_VERSION < '11.4': 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") quit(f"CUDNN version {CUDNN_VERSION} is not supported - please upgrade to 8.9.1")
if CUDNN_VERSION > 8910: if CUDNN_VERSION > 8910:
quit(f"CUDNN version {CUDNN_VERSION} is not supported - please downgrade to 8.9.1") 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: else:
core.globals.providers = ['CPUExecutionProvider'] core.globals.providers = ['CPUExecutionProvider']