From 601b19203f37d67c767f2c9126dffdcdead369ea Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Wed, 17 May 2023 15:26:38 -0400 Subject: [PATCH] Check for CUDA_PATH before adding --- examples/llama_cpp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/llama_cpp.py b/examples/llama_cpp.py index 3ce1820e2..a8f90f861 100644 --- a/examples/llama_cpp.py +++ b/examples/llama_cpp.py @@ -48,7 +48,9 @@ def _load_shared_library(lib_base_name: str): # Add the library directory to the DLL search path on Windows (if needed) if sys.platform == "win32" and sys.version_info >= (3, 8): os.add_dll_directory(str(_base_path)) - os.add_dll_directory(os.path.join(os.environ["CUDA_PATH"], "bin")) + if "CUDA_PATH" in os.environ: + os.add_dll_directory(os.path.join(os.environ["CUDA_PATH"], "bin")) + os.add_dll_directory(os.path.join(os.environ["CUDA_PATH"], "lib")) cdll_args["winmode"] = 0 # Try to load the shared library, handling potential errors