Closed zhouwg closed 3 months ago
05/25/2024
https://github.com/zhouwg/kantv/pull/204
https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的相关代码无法在Android APK正常运行,原因是: 1.需要使用最新的上游llama.cpp代码(仔细处理/合并最新上游代码与https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 中的代码)(https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的代码在Android命令行模式下可以运行,在APK中会crash)
在OpenBMB/MiniCPM-V官方项目主页上,可以看到官方Android APK还在开发中。
本PR解决了https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的相关代码无法在Android APK正常运行的问题,在复用了https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的相关代码后,实现了在Android APK中的MiniCPM-V推理。
基于高通芯片的手机上的Qualcomm CPU/GPU/HTP(NPU)算子加速实现不够完整(高通官网上的资料很有限且相关的开源项目几乎没有 ------ 看了小米MACE端侧推理框架中与QNN相关的代码,参考价值很有限 ------ 几乎每推进一步都需要用逆向工程的方法在手机上去试验)。目前OpenBMB官方放出的图片显示手机上的命令行MiniCPM-V推理速度能到7.56 tokens/秒,本PR中优化后的MiniCPM-V推理速度能到5.49 tokens/秒。
基于高通芯片的手机上使用高通CPU/GPU/HTP后端进行推理加速,在推理结束时(从adb log可以看到MiniCPM-V推理得到了正确结果),APK会crash,这是一个与MiniCPM-V代码无关的已知问题(后面会想办法解决, update on 06-01-2024,此问题已经解决)。
Great job! Thanks for your contribution,We will release the optimized Android APK ASAP.
It's my pleasure I can made a little contribution to the great OpenBMB.
起始日期 | Start Date
05/25/2024
实现PR | Implementation PR
https://github.com/zhouwg/kantv/pull/204
相关Issues | Reference Issues
https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的相关代码无法在Android APK正常运行,原因是: 1.需要使用最新的上游llama.cpp代码(仔细处理/合并最新上游代码与https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 中的代码)(https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的代码在Android命令行模式下可以运行,在APK中会crash)
摘要 | Summary
在OpenBMB/MiniCPM-V官方项目主页上,可以看到官方Android APK还在开发中。
本PR解决了https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的相关代码无法在Android APK正常运行的问题,在复用了https://github.com/OpenBMB/llama.cpp/tree/minicpm-v2.5/examples/minicpmv 的相关代码后,实现了在Android APK中的MiniCPM-V推理。
基本示例 | Basic Example
缺陷 | Drawbacks
基于高通芯片的手机上的Qualcomm CPU/GPU/HTP(NPU)算子加速实现不够完整(高通官网上的资料很有限且相关的开源项目几乎没有 ------ 看了小米MACE端侧推理框架中与QNN相关的代码,参考价值很有限 ------ 几乎每推进一步都需要用逆向工程的方法在手机上去试验)。目前OpenBMB官方放出的图片显示手机上的命令行MiniCPM-V推理速度能到7.56 tokens/秒,本PR中优化后的MiniCPM-V推理速度能到5.49 tokens/秒。
未解决问题 | Unresolved questions
基于高通芯片的手机上使用高通CPU/GPU/HTP后端进行推理加速,在推理结束时(从adb log可以看到MiniCPM-V推理得到了正确结果),APK会crash,这是一个与MiniCPM-V代码无关的已知问题(后面会想办法解决, update on 06-01-2024,此问题已经解决)。