zejunwang1 / lightltp

基于 onnxruntime 推理引擎的中文 ltp 词法分析
13 stars 3 forks source link

您好,求助,demo.py有bug! #2

Open cristianohello opened 1 year ago

cristianohello commented 1 year ago

File "C:\ltponnx\lightltp-main\demo.py", line 12, in seg, pos, hidden = ltp.seg(['颐和园是北京的著名景点']) File "C:\ltponnx\lightltp-main\lightltp\inference.py", line 125, in seg ort_outputs = self.segpos_session.run(None, ort_inputs)

onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type

zejunwang1 commented 1 year ago

File "C:\ltponnx\lightltp-main\demo.py", line 12, in seg, pos, hidden = ltp.seg(['颐和园是北京的著名景点']) File "C:\ltponnx\lightltp-main\lightltp\inference.py", line 125, in seg ort_outputs = self.segpos_session.run(None, ort_inputs)

onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type

我这运行是没有问题的,请检查一下你的 onnxruntime-gpu 版本,以及是不是仅仅安装了 onnxruntime-cpu,如果你安装的是 onnxruntime-cpu 的话,请使用如下命令加载模型: ltp = LTP(path='onnx/', device='cpu')