-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Segmentation error when using graph optimization #5175
Comments
Sorry about that, @NagarajSMurthy! Could you capture a stack trace for the segmentation error (e.g. by running the Python process under Also, to clarify, does the failure still occur if you do not pass any |
Thanks for the response @mrry `(gdb) run onnx_test.py Program received signal SIGSEGV, Segmentation fault. |
Thanks for the update. A couple more questions:
|
Yes, I used the model that you have pointed at. Below is the error under gdb: (gdb) run onnx_test.py Program received signal SIGSEGV, Segmentation fault. |
How can I resolve this issue? @mrry |
@skottmckay, @MaximKalininMS, it looks like a bug in FreeDimensionOverrideTransformer. Please help take a look, and suggest whether it needs to be fixed in 1.5 release. |
I don't see any obvious cause as the free dimension override list should be empty unless specified via session options. If the list is empty the FreeDimensionOverrideTransformer constructor doesn't have much to do. Would need someone with a raspberry pi to do a debug build and see if something is creating a bogus value in SessionOptions.free_dimension_overrides. |
I have got a RaspberryPi. How to do a debug build? |
You'd need to do a debug build and be familiar with a debugger like gdb to set breakpoints in a few places to see if SessionOptions.free_dimension_overrides gets corrupted, and if so when. |
One other thing you could try is building for arm64. I believe the RaspberryPi 3B+ has an Arm Cortex-A53 chip which is 64-bit. May or may not help. If you built with the dockerfile you could modify it to use these as the build args to build arm64
If you wanted to do a debug build, update it from MinSizeRel to Debug:
If you are able to get a debug build onto the device you should be able to run
|
I can't reproduce on a Raspberry Pi 4. When you built ORT did you build on the device, and what was the command line used? |
@skottmckay I didn't cross-compile. I built ORT on my Raspberry Pi 3. |
I've since learned that by default the Raspberry Pi OS is 32-bit despite the CPU being 64-bit. There's a beta 64-bit OS but that's not officially released yet. Due to that, The docker file involves using an emulation layer which shouldn't be necessary if building on device. Not sure if that is problematic. You could try commenting out the lines with The docker file is also using an image for the ORT is 'working' if you disable optimizations as it doesn't run the code that breaks in when that is the case. |
Using https://github.com/microsoft/onnxruntime/blob/master/dockerfiles/Dockerfile.arm32v7 with 2 changes I was able to build ORT and run it successfully on a Raspberry Pi 4B with optimizations enabled.
-RUN [ "cross-build-end" ] docker build -t ort-stretch-py37-arm32v7 -f Dockerfile.arm32v7 .
docker create -ti --name ort_temp ort-stretch-py37-arm32v7 bash
docker cp ort_temp:/code/onnxruntime/build/Linux/MinSizeRel/dist/onnxruntime-1.5.2-cp37-cp37m-linux_armv7l.whl .
docker cp ort_temp:/code/onnxruntime/build/Linux/MinSizeRel/testdata/ort_github_issue_4031.onnx .
pip3 install -U ./onnxruntime-1.5.2-cp37-cp37m-linux_armv7l.whl import onnxruntime as ort
model = 'ort_github_issue_4031.onnx'
optimized_model = 'ort_github_issue_4031.opt.onnx'
so = ort.SessionOptions()
so.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
so.optimized_model_filepath = optimized_model
ort_session = ort.InferenceSession(model,sess_options=so) |
This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details. |
This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details. |
Describe the bug
When creating an inference session, even after specifying the session option 'optimized_model_filepath' to store the optimized model, the program gives segmentation error.
Urgency
Moderate
System information
To Reproduce
so = onnxruntime.SessionOptions()
so.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_BASIC
so.optimized_model_filepath = '/home/pi/Desktop/AI/optimised_model.onnx'
ort_session = onnxruntime.InferenceSession(path,sess_options=so)
Expected behavior
An inference session would have started with graph optimizations set.
The text was updated successfully, but these errors were encountered: