qwen.cpp icon indicating copy to clipboard operation
qwen.cpp copied to clipboard

Plan to merge into ollama?

Open JianxinMa opened this issue 2 years ago • 4 comments

Hi, I just tried running mistral-7b with ollama (https://github.com/jmorganca/ollama) and had a great experience so far. It was easy to install and very efficient to use. It ran really quickly on my 6GB 3060 GPU. So, I wondered, do you have any plans to add qwen to ollama?

P.S.: I tried to compile qwen.cpp on my personal PC (WSL2 on Windows), and unfortunately haven't succeeded yet. It's likely because of some issues with re2.

JianxinMa avatar Sep 29 '23 14:09 JianxinMa

The error I encountered when compiling qwen.cpp is as follows:

(base) mjx@LAPTOP:~/qwen.cpp$ cmake -B build
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:16 (find_package):
  By not providing "Findre2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "re2", but
  CMake did not find one.

  Could not find a package configuration file provided by "re2" with any of
  the following names:

    re2Config.cmake
    re2-config.cmake

  Add the installation prefix of "re2" to CMAKE_PREFIX_PATH or set "re2_DIR"
  to a directory containing one of the above files.  If "re2" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!

JianxinMa avatar Sep 29 '23 14:09 JianxinMa

I installed re2 via sudo apt install libre2-dev. Not sure if it is the correct one.

JianxinMa avatar Oct 04 '23 05:10 JianxinMa

这个pr应该可以解决: https://github.com/QwenLM/qwen.cpp/pull/17

1994 avatar Oct 08 '23 12:10 1994

使用 Findre2.cmake 可以解决

  1. mkdir cmake_modules && touch cmake_modules/Findre2.cmake 写入以下内容到 Findre2.cmake
# 地址根据实际情况来哈
set(RE2_SEARCH_HEADER_PATHS /usr/include)
set(RE2_SEARCH_LIB_PATHS /usr/lib/x86_64-linux-gnu)
find_path(RE2_INCLUDE_DIR re2/re2.h
  PATHS ${RE2_SEARCH_HEADER_PATHS}
        NO_DEFAULT_PATH
  DOC  "Google's re2 regex header path"
)

find_library(RE2_LIBS NAMES re2
  PATHS ${RE2_SEARCH_LIB_PATHS}
        NO_DEFAULT_PATH
  DOC   "Google's re2 regex library"
)

find_library(RE2_STATIC_LIB NAMES libre2.so
  PATHS ${RE2_SEARCH_LIB_PATHS}
        NO_DEFAULT_PATH
  DOC   "Google's re2 regex static library"
)

message(STATUS ${RE2_INCLUDE_DIR})
message(STATUS ${RE2_LIBS})
message(STATUS ${RE2_STATIC_LIB})

if (NOT RE2_INCLUDE_DIR OR NOT RE2_LIBS OR
    NOT RE2_STATIC_LIB)
  set(RE2_FOUND FALSE)
  message(FATAL_ERROR "Re2 includes and libraries NOT found. "
    "Looked for headers in ${RE2_SEARCH_HEADER_PATH}, "
    "and for libs in ${RE2_SEARCH_LIB_PATH}")
else()
  set(RE2_FOUND TRUE)
endif ()

mark_as_advanced(
  RE2_INCLUDE_DIR
  RE2_LIBS
  RE2_STATIC_LIB
)
  1. 修改 CMakeLists.txt
# 添加步骤 1 中 cmake_modules 的目录
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} /home/xxx/workspace/qwen.cpp/cmake_modules)

find_package(re2 REQUIRED)
add_library(re2::re2 INTERFACE IMPORTED)
set_property(TARGET re2::re2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${RE2_INCLUDE_DIRS}")
set_property(TARGET re2::re2 PROPERTY INTERFACE_LINK_LIBRARIES "${RE2_STATIC_LIB}")

mashuiping avatar Oct 12 '23 01:10 mashuiping