Skip to content

Commit

Permalink
low-level / high-level API improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mtasic85 committed Dec 11, 2024
1 parent b2d0f52 commit d603691
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Makefile_6.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion llama/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
20 changes: 17 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -66,19 +78,21 @@ 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
apk -U add mesa-vulkan-ati mesa-vulkan-intel mesa-vulkan-layers mesa-vulkan-swrast vulkan-headers vulkan-loader vulkan-loader-dev vulkan-tools vulkan-validation-layers vulkan-validation-layers-dev vulkan-validation-layers-static shaderc glslang glslang-dev glslang-libs glslang-static
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"
Expand Down
10 changes: 5 additions & 5 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down

0 comments on commit d603691

Please sign in to comment.