Skip to content

Commit

Permalink
Check for CUDA_PATH before adding
Browse files Browse the repository at this point in the history
  • Loading branch information
abetlen authored and Don Mahurin committed May 31, 2023
1 parent db57113 commit 18eca89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/llama_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18eca89

Please sign in to comment.