Skip to content

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

Closed

Description

@Freed-Wu

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.

Activity

  1. abetlen commented on Jul 18, 2023

    @abetlen
    Owner

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

  2. Freed-Wu commented on Jul 18, 2023

    @Freed-Wu
    Author

    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.

  3. Freed-Wu commented on Jul 19, 2023

    @Freed-Wu
    Author

    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)
  4. abetlen commented on Sep 13, 2023

    @abetlen
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions