Skip to content

Commit

Permalink
[feat] merge llm in MNN, add mllm entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhaode committed Dec 27, 2024
1 parent 56a0393 commit 794466f
Show file tree
Hide file tree
Showing 125 changed files with 41,720 additions and 3,022 deletions.
19 changes: 17 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(mnn-llm)

option(BUILD_FOR_ANDROID "Build for android whith mini memory mode." OFF)
option(LLM_SUPPORT_VISION "Llm model support vision input." OFF)
option(LLM_SUPPORT_VISION "Llm model support vision input." ON)
option(DUMP_PROFILE_INFO "Dump profile info when chat." OFF)
option(BUILD_JNI "Build JNI for android app." OFF)

Expand All @@ -15,6 +15,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif()

# compile MNN first
set(MNN_SEP_BUILD OFF CACHE BOOL "Close MNN_SEP_BUILD" FORCE)
set(MNN_BUILD_SHARED_LIBS OFF CACHE BOOL "Close MNN_BUILD_SHARED_LIBS" FORCE)
set(MNN_BUILD_LLM ON CACHE BOOL "Open MNN_BUILD_LLM" FORCE)
set(MNN_LOW_MEMORY ON CACHE BOOL "Open MNN_LOW_MEMORY" FORCE)
set(MNN_SUPPORT_TRANSFORMER_FUSE ON CACHE BOOL "Open MNN_SUPPORT_TRANSFORMER_FUSE" FORCE)
if (BUILD_FOR_ANDROID)
Expand All @@ -33,6 +36,8 @@ include_directories(${CMAKE_CURRENT_LIST_DIR}/include/
${CMAKE_CURRENT_LIST_DIR}/MNN/include/
${CMAKE_CURRENT_LIST_DIR}/MNN/tools/cv/include/
${CMAKE_CURRENT_LIST_DIR}/MNN/MNN/3rd_party/
${CMAKE_CURRENT_LIST_DIR}/MNN/source/
${CMAKE_CURRENT_LIST_DIR}/MNN/transformers/llm/engine/include
)

# source files
Expand All @@ -43,6 +48,16 @@ if (BUILD_JNI)
list(APPEND SRCS "${CMAKE_CURRENT_LIST_DIR}/android/app/src/main/jni/llm_mnn_jni.cpp")
endif()

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
endif()

add_executable(mllm ${CMAKE_CURRENT_LIST_DIR}/src/main.cpp)
target_link_libraries(mllm MNN)
if (0)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
Expand All @@ -66,7 +81,6 @@ else()
endif()

if (NOT (BUILD_JNI))

add_executable(cli_demo ${CMAKE_CURRENT_LIST_DIR}/demo/cli_demo.cpp)
add_executable(tokenizer_demo ${CMAKE_CURRENT_LIST_DIR}/demo/tokenizer_demo.cpp)
add_executable(embedding_demo ${CMAKE_CURRENT_LIST_DIR}/demo/embedding_demo.cpp)
Expand Down Expand Up @@ -134,4 +148,5 @@ else()
COMMAND ${CMAKE_COMMAND} -E copy
${LLM_LIBS}
${CMAKE_CURRENT_LIST_DIR}/android/app/src/main/jni/libs/arm64-v8a)
endif()
endif()
96 changes: 0 additions & 96 deletions demo/README.md

This file was deleted.

67 changes: 0 additions & 67 deletions demo/cli_demo.cpp

This file was deleted.

26 changes: 0 additions & 26 deletions demo/document_demo.cpp

This file was deleted.

44 changes: 0 additions & 44 deletions demo/embedding_demo.cpp

This file was deleted.

33 changes: 0 additions & 33 deletions demo/knowledge_demo.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions demo/memory_demo.cpp

This file was deleted.

Loading

0 comments on commit 794466f

Please sign in to comment.