From d603691a5f2ad67bfa59beb3bd2423a9dab674e5 Mon Sep 17 00:00:00 2001 From: Marko Tasic Date: Wed, 11 Dec 2024 11:53:05 +0100 Subject: [PATCH] low-level / high-level API improvements --- Makefile_6.patch | 6 +++--- llama/llama.py | 2 +- pyproject.toml | 20 +++++++++++++++++--- scripts/build.py | 10 +++++----- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Makefile_6.patch b/Makefile_6.patch index f048d27..3f8a25c 100644 --- a/Makefile_6.patch +++ b/Makefile_6.patch @@ -20,9 +20,9 @@ common/base64.hpp \ $(OBJ_ALL) - $(CXX) $(CXXFLAGS) -static -fPIC -c $< -o $@ -Wno-cast-qual -+ $(CXX) $(CXXFLAGS) -DLLAVA_LOG_OFF -c examples/llava/llava.cpp -o examples/llava/llava.o -+ $(CXX) $(CXXFLAGS) -DLLAVA_LOG_OFF -c examples/llava/clip.cpp -o examples/llava/clip.o -+ $(CXX) $(CXXFLAGS) -DLLAVA_LOG_OFF -c examples/llava/mllama.cpp -o examples/llava/mllama.o ++ $(CXX) $(CXXFLAGS) -c examples/llava/llava.cpp -o examples/llava/llava.o ++ $(CXX) $(CXXFLAGS) -c examples/llava/clip.cpp -o examples/llava/clip.o ++ $(CXX) $(CXXFLAGS) -c examples/llava/mllama.cpp -o examples/llava/mllama.o + ar rcs $@ examples/llava/llava.o examples/llava/clip.o examples/llava/mllama.o llama-llava-cli: examples/llava/llava-cli.cpp \ diff --git a/llama/llama.py b/llama/llama.py index b06aa9f..5935a4b 100644 --- a/llama/llama.py +++ b/llama/llama.py @@ -263,7 +263,7 @@ def sampler_free(sampler: llama_sampler_p): def clip_init_context(options: Options) -> clip_ctx_p: mmproj_path: str = hf_hub_download(repo_id=options.model.hf_repo, filename=options.model.mmproj_hf_file) - clip_context: clip_ctx_p = lib.clip_model_load(mmproj_path.encode(), 1) + clip_context: clip_ctx_p = lib.clip_model_load(mmproj_path.encode(), 0) # path, verbosity return clip_context diff --git a/pyproject.toml b/pyproject.toml index 90f80bd..42287c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,19 @@ if [[ $AUDITWHEEL_PLAT == manylinux* ]]; then dnf update -y dnf install -y epel-release dnf update -y - dnf install -y unzip p7zip p7zip-plugins upx clang-tools-extra + dnf group install -y "Development Tools" + # dnf install -y unzip p7zip p7zip-plugins upx clang-tools-extra libcurl-devel + dnf install -y clang-tools-extra libcurl-devel ninja-build + + git clone https://github.com/google/shaderc + cd shaderc + ./utils/git-sync-deps + mkdir build + cd build + cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../ + ninja + ninja install + cd ../.. # vulkan if [[ "$ARCH" == "x86_64" ]]; then @@ -66,7 +78,8 @@ if [[ $AUDITWHEEL_PLAT == manylinux* ]]; then dnf install -y https://pkgs.sysadmins.ws/el8/extras/x86_64/glslc-2023.1-3.el8.x86_64.rpm https://pkgs.sysadmins.ws/el8/extras/x86_64/glslang-12.0.0-1.el8.x86_64.rpm fi else - apk -U add unzip 7zip upx clang-extra-tools + # apk -U add unzip 7zip upx clang-extra-tools + apk -U add clang-extra-tools curl-dev ninja-build # vulkan if [[ "$ARCH" == "x86_64" ]]; then @@ -74,11 +87,12 @@ else fi fi """ -skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "pp37-*", "pp38-*", "pp39-*", "*i686"] +# skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "pp37-*", "pp38-*", "pp39-*", "*i686"] # skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp313-*", "pp37-*", "pp38-*", "pp39-*", "*i686"] # skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "pp37-*", "pp38-*", "pp39-*", "*i686", "*manylinux*"] # skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*", "pp37-*", "pp38-*", "pp39-*", "pp310-*", "*i686"] # skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*", "pp37-*", "pp38-*", "pp39-*", "pp310-*", "*i686", "*musllinux*"] +skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp311-*", "cp313-*", "pp37-*", "pp38-*", "pp39-*", "pp310-*", "*i686", "*musllinux*"] # skip = ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp313-*", "pp37-*", "pp38-*", "pp39-*", "pp310-*", "*i686", "*musllinux*"] manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64:latest" manylinux-aarch64-image = "quay.io/pypa/manylinux_2_28_aarch64:latest" diff --git a/scripts/build.py b/scripts/build.py index 3e5cd4c..857d354 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -847,11 +847,11 @@ def build(*args, **kwargs): clean_llama_cpp() build_vulkan_1_x(*args, **kwargs) - # # cuda 12.6.3 - # if env.get('GGML_CUDA', '1') != '0': - # if env.get('AUDITWHEEL_POLICY') in ('manylinux2014', 'manylinux_2_28', None) and env.get('AUDITWHEEL_ARCH') in ('x86_64', None): - # clean_llama_cpp() - # build_linux_cuda_12_6_3(*args, **kwargs) + # cuda 12.6.3 + if env.get('GGML_CUDA', '1') != '0': + if env.get('AUDITWHEEL_POLICY') in ('manylinux2014', 'manylinux_2_28', None) and env.get('AUDITWHEEL_ARCH') in ('x86_64', None): + clean_llama_cpp() + build_linux_cuda_12_6_3(*args, **kwargs) if __name__ == '__main__':