MNN icon indicating copy to clipboard operation
MNN copied to clipboard

Backend设置Precision_Low,部分图片输出结果正常,部分图片输出全0

Open atlantis1314 opened this issue 1 year ago • 3 comments

 MNN::ScheduleConfig netConfig;
 netConfig.type = MNN_FORWARD_CPU;
netConfig.numThread = 4;
netConfig.backupType = netConfig.type;
MNN::BackendConfig backend_config;
backend_config.precision = MNN::BackendConfig::Precision_Low; 
netConfig.backendConfig = &backend_config;
session = net->createSession(netConfig);
mnn设置如上,当设置Precision_Normal 或Precision_High时,所有测试图片输出结果都正常,
为了提升性能,设置Precision_Low时,部分图片输出结果正常,部分图片输出结果全为0,
能帮忙分析下是什么原因吗,或者给点建议,谢谢!
使用的模型是同问题2960的lama模型。

编译时也设置了MNN_ARM82=ON
打开了mnn的日志输出,只有
MNNJNI  : The device support i8sdot:1, support fp16:1, support i8mm: 0
硬件平台应该是支持fp16的。

平台(如果交叉编译请再附上交叉编译目标平台):

编译平台:Ubuntu 18.04.6
程序运行平台:android手机, 高通芯片 6450

Github版本:

mnn2.8.0

编译方式:

cmake ../../../
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
-DCMAKE_BUILD_TYPE=Release
-DANDROID_ABI="arm64-v8a"
-DANDROID_STL=c++_static
-DMNN_USE_LOGCAT=true
-DMNN_BUILD_BENCHMARK=ON
-DMNN_USE_SSE=OFF
-DMNN_OPENCL=ON
-DMNN_VULKAN=ON
-DMNN_ARM82=ON
-DMNN_SUPPORT_BF16=ON
-DMNN_BUILD_OPENCV=ON
-DMNN_BUILD_TEST=ON
-DANDROID_NATIVE_API_LEVEL=android-21
-DMNN_BUILD_FOR_ANDROID_COMMAND=true
-DNATIVE_LIBRARY_OUTPUT=. -DNATIVE_INCLUDE_OUTPUT=. $1 $2 $3

atlantis1314 avatar Jul 30 '24 06:07 atlantis1314

后端为MNN_FORWARD_CPU时问题相同,但设置后端为MNN_FORWARD_OPENCL,Precision_Low又结果正常,请问有解决方案吗

ljdang avatar Aug 05 '24 02:08 ljdang

  1. 更新 MNN 到最新;2. 用 https://mnn-docs.readthedocs.io/en/latest/tools/test.html#modulebasic-out 测试一下看看,加上 mask = 2 看下哪层出的异常

jxt1234 avatar Aug 20 '24 06:08 jxt1234

1、更新mnn到2.9.3,问题还是存在,部分图片输出全0 以下是输入测试图片 正常结果图片.zip 错误结果图片.zip

2、使用ModuleBasic.out 进行测试, 设置参数 2 0 2 1 2 在output目录只输出1个文件 0_0.txt, 看不出哪层有问题

0_0.zip

atlantis1314 avatar Aug 26 '24 03:08 atlantis1314

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Oct 25 '24 09:10 github-actions[bot]