Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

推理时模型维度报错 #2

Open
ysujiang opened this issue Mar 10, 2022 · 3 comments
Open

推理时模型维度报错 #2

ysujiang opened this issue Mar 10, 2022 · 3 comments

Comments

@ysujiang
Copy link

ysujiang commented Mar 10, 2022

File "torch_to_onnx.py", line 190, in
conver_bert_torch_to_onnx()
File "torch_to_onnx.py", line 104, in conver_bert_torch_to_onnx
sess = onnxruntime.InferenceSession(MODEL_ONNX_PATH)
File "/opt/conda/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 335, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "/opt/conda/lib/python3.7/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 379, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Node (Squeeze_1169) Op (Squeeze) [ShapeInferenceError] Dimension of input 1 must be 1 instead of 768
有遇到过这样的问题吗

@yuanzhoulvpi2017
Copy link
Owner

是不是模型选的不对,这个只是针对那一个模型做了加速,如果换别的模型,需要修改代码,目前我还没完备代码

@ysujiang
Copy link
Author

我是用的pytorch_model.bin这个模型,需要改那一部分代码能否告知一下

@zlszhonglongshen
Copy link

哈哈,只是针对某一个模型才有用的~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants