I am trying to run GPT-2 on magic leap with the ggml library. By now, I have succeeded in running ggml examples on my Windows computer. However, I don’t know how to link all the libraries and the header files to my magic leap application project on Android Studio.
My magic leap application project is based on a sample from mlsdk 17.0 c-api samples where I only changed the content of main.cpp. My idea is to link ggml library to my project so that I can load LLM models on my Magic Leap. But I don’t know what kind of libraries can be linked to magic leap project and how to do this.
Below is the Build Output.
ld.lld: error: unable to find library -lggml
ld.lld: error: unable to find library -lcommon
ld.lld: error: unable to find library -lcommon-ggml
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Below is my CMakeLists based on the sample:
cmake_minimum_required(VERSION 3.22.1)
project(eye_tracking)
message(STATUS "MLSDK path: ${MLSDK}")
file(TO_CMAKE_PATH "$ENV{MLSDK}" MLSDK)
list(APPEND CMAKE_MODULE_PATH "${MLSDK}/cmake" "${ANDROID_NDK}/../../mlsdk/cmake")
find_package(MagicLeap REQUIRED)
find_package(MagicLeapAppFramework REQUIRED)
add_library(eye_tracking SHARED main.cpp virtual_keyboard.cpp main-backend.cpp)
include(DeprecatedApiUsage)
use_deprecated_api(eye_tracking)
target_link_libraries(eye_tracking
ML::app_framework
ggml
common
common-ggml
)
target_compile_options(eye_tracking PRIVATE -Wno-error)
if (COMMAND copy_artifacts)
copy_artifacts(eye_tracking)
endif()
I copied needed .h files in the same path as main.cpp, shown in the pic.
enter image description here
I copied needed .dll and .lib files to “..MagicLeapmlsdkv1.7.0libwin”, shown below.
Ml folder contains .sh while win folder contains .dll and .lib files, so I guess Magic Leap can use .dll files.(shown below)
enter image description here
enter image description here
I have succeeded in running examples(gpt-2-backend project) of GGML from github by using Visual Studio 2022.
I expect to run this example on Magic Leap 2 by including relative libraries and modifying the original code of main-backend.cpp and CMakeLists.txt. I want it no java, because the Magic Leap Samples have no java files.
Xinyu Liu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1