Bugfix: cross-platform method to find shared lib
This commit is contained in:
parent
bd1c657f80
commit
a3da39af79
1 changed files with 7 additions and 3 deletions
|
@ -12,11 +12,15 @@ from ctypes import (
|
||||||
)
|
)
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
from itertools import chain
|
||||||
|
|
||||||
# Load the library
|
# Load the library
|
||||||
libfile = pathlib.Path(__file__).parent / "libllama.so"
|
# TODO: fragile, should fix
|
||||||
_lib = ctypes.CDLL(str(libfile))
|
_base_path = pathlib.Path(__file__).parent
|
||||||
|
(_lib_path,) = chain(
|
||||||
|
_base_path.glob("*.so"), _base_path.glob("*.dylib"), _base_path.glob("*.dll")
|
||||||
|
)
|
||||||
|
_lib = ctypes.CDLL(str(_lib_path))
|
||||||
|
|
||||||
# C types
|
# C types
|
||||||
llama_context_p = c_void_p
|
llama_context_p = c_void_p
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue