Use environment variable for library override
This commit is contained in:
parent
d1b3517477
commit
c8b5d0b963
1 changed files with 3 additions and 3 deletions
|
@ -29,16 +29,16 @@ def _load_shared_library(lib_base_name):
|
||||||
|
|
||||||
# Construct the paths to the possible shared library names
|
# Construct the paths to the possible shared library names
|
||||||
_base_path = pathlib.Path(__file__).parent.resolve()
|
_base_path = pathlib.Path(__file__).parent.resolve()
|
||||||
_local_path = pathlib.Path.cwd()
|
|
||||||
# Searching for the library in the current directory under the name "libllama" (default name
|
# Searching for the library in the current directory under the name "libllama" (default name
|
||||||
# for llamacpp) and "llama" (default name for this repo)
|
# for llamacpp) and "llama" (default name for this repo)
|
||||||
_lib_paths = [
|
_lib_paths = [
|
||||||
_local_path / f"./lib{lib_base_name}{lib_ext}",
|
|
||||||
_local_path / f"./{lib_base_name}{lib_ext}",
|
|
||||||
_base_path / f"lib{lib_base_name}{lib_ext}",
|
_base_path / f"lib{lib_base_name}{lib_ext}",
|
||||||
_base_path / f"{lib_base_name}{lib_ext}"
|
_base_path / f"{lib_base_name}{lib_ext}"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if ("LLAMA_CPP_LIB" in os.environ):
|
||||||
|
_lib_paths = [pathlib.Path(os.environ["LLAMA_CPP_LIB"]).resolve()]
|
||||||
|
|
||||||
# Add the library directory to the DLL search path on Windows (if needed)
|
# Add the library directory to the DLL search path on Windows (if needed)
|
||||||
if sys.platform == "win32" and sys.version_info >= (3, 8):
|
if sys.platform == "win32" and sys.version_info >= (3, 8):
|
||||||
os.add_dll_directory(str(_base_path))
|
os.add_dll_directory(str(_base_path))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue