aab74f0b2b
* llava v1.5 integration * Point llama.cpp to fork * Add llava shared library target * Fix type * Update llama.cpp * Add llava api * Revert changes to llama and llama_cpp * Update llava example * Add types for new gpt-4-vision-preview api * Fix typo * Update llama.cpp * Update llama_types to match OpenAI v1 API * Update ChatCompletionFunction type * Reorder request parameters * More API type fixes * Even More Type Updates * Add parameter for custom chat_handler to Llama class * Fix circular import * Convert to absolute imports * Fix * Fix pydantic Jsontype bug * Accept list of prompt tokens in create_completion * Add llava1.5 chat handler * Add Multimodal notebook * Clean up examples * Add server docs --------- Co-authored-by: Andrei Betlen <abetlen@gmail.com>
63 lines
2.7 KiB
CMake
63 lines
2.7 KiB
CMake
cmake_minimum_required(VERSION 3.21)
|
|
|
|
project(llama_cpp)
|
|
|
|
option(LLAMA_BUILD "Build llama.cpp shared library and install alongside python package" ON)
|
|
|
|
if (LLAMA_BUILD)
|
|
set(BUILD_SHARED_LIBS "On")
|
|
if (APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
|
|
# Need to disable these llama.cpp flags on Apple x86_64,
|
|
# otherwise users may encounter invalid instruction errors
|
|
set(LLAMA_AVX "Off" CACHE BOOL "llama: enable AVX" FORCE)
|
|
set(LLAMA_AVX2 "Off" CACHE BOOL "llama: enable AVX2" FORCE)
|
|
set(LLAMA_FMA "Off" CACHE BOOL "llama: enable FMA" FORCE)
|
|
set(LLAMA_F16C "Off" CACHE BOOL "llama: enable F16C" FORCE)
|
|
endif()
|
|
add_subdirectory(vendor/llama.cpp)
|
|
install(
|
|
TARGETS llama
|
|
LIBRARY DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
RUNTIME DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
ARCHIVE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
FRAMEWORK DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
RESOURCE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
)
|
|
# Temporary fix for https://github.com/scikit-build/scikit-build-core/issues/374
|
|
install(
|
|
TARGETS llama
|
|
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
)
|
|
# Workaround for Windows + CUDA https://github.com/abetlen/llama-cpp-python/issues/563
|
|
install(
|
|
FILES $<TARGET_RUNTIME_DLLS:llama>
|
|
DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
)
|
|
install(
|
|
FILES $<TARGET_RUNTIME_DLLS:llama>
|
|
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
)
|
|
add_subdirectory(vendor/llama.cpp/examples/llava)
|
|
set_target_properties(llava_shared PROPERTIES OUTPUT_NAME "llava")
|
|
install(
|
|
TARGETS llava_shared
|
|
LIBRARY DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
RUNTIME DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
ARCHIVE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
FRAMEWORK DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
RESOURCE DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp
|
|
)
|
|
# Temporary fix for https://github.com/scikit-build/scikit-build-core/issues/374
|
|
install(
|
|
TARGETS llava_shared
|
|
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
|
)
|
|
endif()
|