File size: 574 Bytes
9e1f09f
e37abe2
2800109
9e1f09f
83c25ba
f3be2ab
9e1f09f
 
 
 
 
 
 
 
 
b2fe609
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
import subprocess

# Uninstall the existing llama-cpp-python package
subprocess.run("pip uninstall -y llama-cpp-python", shell=True)

# Get the path to the CUDA compiler
cuda_path = os.environ.get("CUDA_PATH", "/usr/local/cuda")
nvcc_path = os.path.join(cuda_path, "bin", "nvcc")

# Set the CMAKE_CUDA_COMPILER environment variable
os.environ["CMAKE_CUDA_COMPILER"] = nvcc_path

# Install llama-cpp-python with CUDA support
install_command = "pip install llama-cpp-python --install-option='--cmake-args=-DLLAMA_CUDA=on'"
subprocess.run(install_command, shell=True)