capi加载模型出错mapGet(type, creatorMap_, &creator) Unknown class type: data
realsnake opened this issue · comments
realsnake commented
ar_infer.paddle.zip
我使用了merge_model 生成了.paddle文件以供capi加载
init没报错应该是成功了,paddle_gradient_machine_create_for_inference_with_parameters报错了,传入的参数buf无为空,size对比模型文件本身大小是一致的,错误log如下:
I0109 20:28:47.075923 3058023296 Util.cpp:166] commandline: --use_gpu=False --pool_limit_size=0
F0109 20:28:58.992383 3058023296 ClassRegistrar.h:65] Check failed: mapGet(type, creatorMap_, &creator) Unknown class type: data
*** Check failure stack trace: ***
2018-01-09 20:28:59.041616+0800 IphoneCom[3630:2417368] Task <A23BCE12-DE2B-4E27-92CD-C29598C63E49>.<2> finished with error - code: -1001
2018-01-09 20:28:59.047358+0800 IphoneCom[3630:2417138] TIC TCP Conn Failed [2:0x1c0176500]: 3:-9802 Err(-9802)
2018-01-09 20:28:59.048243+0800 IphoneCom[3630:2417138] Task <A23BCE12-DE2B-4E27-92CD-C29598C63E49>.<2> HTTP load failed (error code: -999 [1:89])
@ 0x1059942e0 google::LogMessage::Fail()
@ 0x105993408 google::LogMessage::SendToLog()
@ 0x105993bdc google::LogMessage::Flush()
@ 0x1059971b4 google::LogMessageFatal::~LogMessageFatal()
@ 0x105994620 google::LogMessageFatal::~LogMessageFatal()
@ 0x105918f10 _ZN6paddle14ClassRegistrarINS_5LayerEJNS_11LayerConfigEEE12createByTypeERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEES2_
@ 0x105918d94 paddle::Layer::create()
@ 0x10591a75c paddle::NeuralNetwork::init()::$_0::operator()()
@ 0x10591a010 paddle::NeuralNetwork::init()
@ 0x10591f250 paddle::GradientMachine::create()
@ 0x105917410 paddle_gradient_machine_create_for_inference_with_parameters
@ 0x1043e0548 init_machine()
@ 0x1043e0280 -[BNLocationManager init]
@ 0x1043dff10 +[BNLocationManager GetInstance]
@ 0x104520878 +[BNCoreServices LocationService]
@ 0x10451c988 -[BNCoreServices doAfterInitEngine]
@ 0x1045195bc __40-[BNCoreServices startSericesAsyn:fail:]_block_invoke_2
@ 0x10f87d2cc _dispatch_call_block_and_release
@ 0x10f87d28c _dispatch_client_callout
@ 0x10f881ea0 _dispatch_main_queue_callback_4CF
@ 0x1851b2544 <redacted>
@ 0x1851b0120 <redacted>
@ 0x1850cfe58 CFRunLoopRunSpecific
@ 0x186f7cf84 GSEventRunModal
@ 0x18e74f67c UIApplicationMain
@ 0x102ee0c30 main
@ 0x184bec56c <redacted>
Yiqun Liu commented
你好,上述错误应该是没有正确地链接Paddle库。请问你的链接方式是?
- 如果是应用在Android App中,请参考#61 中的CMakeLists.txt和FindPaddle.cmake,其中FindPaddle.cmake可以直接拿过来复用。
- 如果你是应用在Linux服务器上或者是命令行方式运行Android二进制文件,可以参考https://github.com/PaddlePaddle/Mobile/tree/develop/Demo/linux 和 https://github.com/PaddlePaddle/Mobile/tree/develop/benchmark/tool/C 。
Mobile/benchmark/tool/C/CMakeLists.txt
Lines 41 to 45 in be2817a
无论参考哪个,都需要保证-Wl,--whole-archive -lpaddle_capi_layers
,即使用whole-archive
链接libpaddle_capi_layers.a
Yiqun Liu commented
仔细看了下log,貌似你是在iOS App中使用Paddle?那么Paddle的链接方式请参考:https://github.com/PaddlePaddle/Mobile/blob/develop/Demo/iOS/AICamera/README_cn.md#%E5%A6%82%E4%BD%95%E9%93%BE%E6%8E%A5paddlepaddle%E5%BA%93 。
需要配置-force_load
链接libpaddle_capi_layers.a
。
realsnake commented
恩,是这个问题,已解决多谢!