Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can it provide an cmake option to disable building of libllama.so? #484

Closed
Freed-Wu opened this issue Jul 18, 2023 · 4 comments
Closed

Can it provide an cmake option to disable building of libllama.so? #484

Freed-Wu opened this issue Jul 18, 2023 · 4 comments
Labels
build enhancement New feature or request

Comments

@Freed-Wu
Copy link

Describe the solution you'd like
Can it provide a cmake option to disable building of libllama.so? I hope use /usr/lib/libllama.so provided by llama.cpp not /usr/lib/python3.11/site-packages/llama_cpp/libllama.so. I am packaging it to linux distribution, if so, user will not need to install 2 libllama.so.

@abetlen
Copy link
Owner

abetlen commented Jul 18, 2023

@Freed-Wu happy to add this, the main issue I see coming up is version mismatch between llama-cpp-python and llama.cpp.

@Freed-Wu
Copy link
Author

Freed-Wu commented Jul 18, 2023

the main issue I see coming up is version mismatch between llama-cpp-python and llama.cpp.

This issue just leave packager solve it. they have duty to keep it match. It is not a default option so no users will meet it.

@Freed-Wu
Copy link
Author

Freed-Wu commented Jul 19, 2023

And if user install the package without building libllama.so, Can this package load it from platformdir's user_data_dir, site_data_dir?

import sys
from ctypes import CDLL
from pathlib import Path

from platfromdirs import user_data_dir

ext = {"linux": "so", "win32": "dll", "darwin": "dylib"}[sys.platform]
for libpath in [Path(__file__).parent, user_data_path().parent / 'lib', site_data_path().parent / 'lib']:
    if not (libpath / f"libllama.{ext}").exists():
        continute
    dll_path = str(libpath)
dll = CDLL(dll_path)

@gjmulder gjmulder added enhancement New feature or request build labels Jul 30, 2023
@abetlen
Copy link
Owner

abetlen commented Sep 13, 2023

Added in v0.2 was a LLAMA_BUILD cmake flag that can be set to OFF to disable compiling the library, then you can just use the LLAMA_CPP_LIB env variable to point to a pre-built shared library (no guarantee on version compatibility though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants