Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e3941d9

Browse filesBrowse files
committed
Make building llava optional
1 parent 74f1949 commit e3941d9
Copy full SHA for e3941d9

File tree

Expand file treeCollapse file tree

2 files changed

+28
-25
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+28
-25
lines changed

‎CMakeLists.txt

Copy file name to clipboardExpand all lines: CMakeLists.txt
+26-23Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.21)
33
project(llama_cpp)
44

55
option(LLAMA_BUILD "Build llama.cpp shared library and install alongside python package" ON)
6+
option(LLAVA_BUILD "Build llava shared library and install alongside python package" ON)
67

78
if (LLAMA_BUILD)
89
set(BUILD_SHARED_LIBS "On")
@@ -44,28 +45,30 @@ if (LLAMA_BUILD)
4445
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
4546
)
4647

47-
# Building llava
48-
add_subdirectory(vendor/llama.cpp/examples/llava)
49-
set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")
50-
# Set CUDA_ARCHITECTURES to OFF on windows
51-
if (WIN32)
52-
set_target_properties(llava_shared PROPERTIES CUDA_ARCHITECTURES OFF)
48+
if (LLAVA_BUILD)
49+
# Building llava
50+
add_subdirectory(vendor/llama.cpp/examples/llava)
51+
set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")
52+
# Set CUDA_ARCHITECTURES to OFF on windows
53+
if (WIN32)
54+
set_target_properties(llava_shared PROPERTIES CUDA_ARCHITECTURES OFF)
55+
endif()
56+
install(
57+
TARGETS llava_shared
58+
LIBRARY DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
59+
RUNTIME DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
60+
ARCHIVE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
61+
FRAMEWORK DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
62+
RESOURCE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
63+
)
64+
# Temporary fix for https://github.com/scikit-build/scikit-build-core/issues/374
65+
install(
66+
TARGETS llava_shared
67+
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
68+
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
69+
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
70+
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
71+
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
72+
)
5373
endif()
54-
install(
55-
TARGETS llava_shared
56-
LIBRARY DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
57-
RUNTIME DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
58-
ARCHIVE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
59-
FRAMEWORK DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
60-
RESOURCE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
61-
)
62-
# Temporary fix for https://github.com/scikit-build/scikit-build-core/issues/374
63-
install(
64-
TARGETS llava_shared
65-
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
66-
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
67-
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
68-
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
69-
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
70-
)
7174
endif()

‎llama_cpp/llava_cpp.py

Copy file name to clipboardExpand all lines: llama_cpp/llava_cpp.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def _load_shared_library(lib_base_name: str):
4848
else:
4949
raise RuntimeError("Unsupported platform")
5050

51-
if "LLAMA_CPP_LIB" in os.environ:
52-
lib_base_name = os.environ["LLAMA_CPP_LIB"]
51+
if "LLAVA_CPP_LIB" in os.environ:
52+
lib_base_name = os.environ["LLAVA_CPP_LIB"]
5353
_lib = pathlib.Path(lib_base_name)
5454
_base_path = _lib.parent.resolve()
5555
_lib_paths = [_lib.resolve()]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.