mnn llm
llama3-8b-instruct-mnn
# clone
git clone --recurse-submodules https://github.com/wangzhaode/mnn-llm.git
cd mnn-llm
# linux
./script/build.sh
# macos
./script/build.sh
# windows msvc
./script/build.ps1
# python wheel
./script/py_build.sh
# android
./script/android_build.sh
# android apk
./script/android_app_build.sh
# ios
./script/ios_build.sh
Algunas macros de compilación:
BUILD_FOR_ANDROID
: compilar en dispositivos Android;LLM_SUPPORT_VISION
: si se admiten capacidades de procesamiento visual;DUMP_PROFILE_INFO
: volcar datos de rendimiento a la línea de comando después de cada sesión; CPU
se usa de forma predeterminada. Si usa otros backends o capacidades, puede agregar la macro de compilación MNN
al compilar MNN.
-DMNN_CUDA=ON
-DMNN_OPENCL=ON
-DMNN_METAL=ON
# linux/macos
./cli_demo ./Qwen2-1.5B-Instruct-MNN/config.json # cli demo
./web_demo ./Qwen2-1.5B-Instruct-MNN/config.json ../web # web ui demo
# windows
. D ebug c li_demo.exe ./Qwen2-1.5B-Instruct-MNN/config.json
. D ebug w eb_demo.exe ./Qwen2-1.5B-Instruct-MNN/config.json ../web
# android
adb push android_build/MNN/OFF/arm64-v8a/libMNN.so /data/local/tmp
adb push android_build/MNN/express/OFF/arm64-v8a/libMNN_Express.so /data/local/tmp
adb push android_build/libllm.so android_build/cli_demo /data/local/tmp
adb push Qwen2-1.5B-Instruct-MNN /data/local/tmp
adb shell " cd /data/local/tmp && export LD_LIBRARY_PATH=. && ./cli_demo ./Qwen2-1.5B-Instruct-MNN/config.json "