Tencent / TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
Other
4.37k stars 765 forks source link

benchmark_android时,报错source/tnn/optimizer/graph_matcher/ir.cc:750 map::at: key not found. Segmentation error #1969

Closed wb014 closed 8 months ago

wb014 commented 9 months ago

1. 环境(environment)

-- Build TNN OpenCL -- Configuring done -- Generating done -- Build files have been written to: /home/mjw/Projects_zwb/TNN/benchmark/benchmark_android/build Scanning dependencies of target TNNArm82 Scanning dependencies of target TNNArm Consolidate compiler generated dependencies of target TNNArm82 Consolidate compiler generated dependencies of target TNNArm Consolidate compiler generated dependencies of target TNNOpenCL [ 6%] Built target TNNArm82 Consolidate compiler generated dependencies of target gflags_nothreads_static Consolidate compiler generated dependencies of target TNNCpu [ 7%] Built target gflags_nothreads_static [ 8%] Building CXX object source/tnn/device/opencl/CMakeFiles/TNNOpenCL.dir/cl/opencl_program.cc.o [ 23%] Built target TNNArm [ 40%] Built target TNNCpu [ 54%] Built target TNNOpenCL Consolidate compiler generated dependencies of target TNN [ 54%] Linking CXX shared library libTNN.so [ 99%] Built target TNN Consolidate compiler generated dependencies of target TNNBenchmarkTest Consolidate compiler generated dependencies of target TNNTest [ 99%] Linking CXX executable TNNTest [ 99%] Linking CXX shared library libTNNBenchmarkTest.so [100%] Built target TNNBenchmarkTest [100%] Built target TNNTest ./libTNN.so: 1 file pushed. 36.1 MB/s (8056256 bytes in 0.213s) ./test/libTNNBenchmarkTest.so: 1 file pushed. 21.3 MB/s (211280 bytes in 0.009s) test/TNNTest: 1 file pushed. 14.7 MB/s (191344 bytes in 0.012s) /home/mjw/Projects_zwb/TNN/benchmark/b...hed. 2.8 MB/s (277330 bytes in 0.093s) 2023-11-22 10:08:10 196: E source/tnn/optimizer/graph_matcher/ir.cc:750 map::at: key not found E/tnn: bool tnn::test::CheckResult(std::string, Status) [File test/test.cc][Line 338] create instance failed: code: 0x6000 msg: map::at: key not found /data/local/tmp/tnn-benchmark/benchmar... pulled. 0.0 MB/s (64 bytes in 0.002s) SM-G9810

benchmark device: ARM

Wed Nov 22 10:08:15 CST 2023

wb014 commented 9 months ago

我这里测试出来bug可能位置在multiheadattn上,经过self.linear(value)的linear层后,就会报“map::at: key not found”这个error

wb014 commented 9 months ago

后续的scores = torch.matmul(query, key),同样报错。 E/tnn: virtual Status tnn::MatMulLayerResourceGenerator::GenLayerResource(LayerParam *, LayerResource *, std::vector<Blob > &) [File source/tnn/interpreter/layer_resource_generator.cc][Line 544] [WARNNING] can't infer resource shape from MatMul param in benchmark mode, random generator may not be exactly same with the real resource! 请问有解决办法吗,onnx2tnn用的docker最新镜像,benchmark用的tnn master分支

wb014 commented 8 months ago

clean the obsolete tnnproto in server and android before convert and benchmark, the question not emerge again