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

MobileNet-V1: Verification step stitched_ip_rtlsim throws an error #1113

Closed
hannahxy13 opened this issue Jun 26, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@hannahxy13
Copy link

Quick summary

When running the build flow for MobileNet-V1 from FINN-examples, when the verification step "stitched_ip_rtlsim" is run, which happens at "step_create_stitched_ip", an error is thrown.

Details

The verification step "stitched_ip_rtlsim" was added to the build flow for MobileNet-V1, from the FINN-examples repository. When the build is run using Docker, once "step_create_stitched_ip" is reached, the following error is thrown:

return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type. Actual: (tensor(float)) , expected: (tensor(int64))

It seems that the verification datatype is float, but is expected to be int64.

Looking at the intermediate ONNX models, it seems the issue is occurring in the LabelSelect node at the end of the model. Attached are screenshots from Netron showing the properties of the output tensor of the LabelSelect node for the different steps in the build flow:

  • step_hw_ipgen.onnx
    image

  • step_set_fifo_depths.onnx
    image

  • verify_step_stitched_rtlsim.onnx
    image

It can be seen that at "step_hw_ipgen", the datatype is int64. The step right after it, "step_set_fifo_depths", appears to change the datatype to float32, and this change persists in the following step "step_create_stitched_ip", which causes the verification step "stitched_ip_rtlsim" to fail.

ONNX files:
mobilenetv1_onnx_files.zip

Steps to Reproduce

  1. Clone the FINN repository
  2. Checkout the dev branch, with commit hash: [25c1c99]
  3. Set the environment variable FINN_ROOT as the FINN repository that was cloned
  4. Clone the FINN-examples repository
  5. Add the verification step "stitched_ip_rtlsim" to the build.py file for the MobileNet-V1 model build configuration
  6. Download the MobileNet-V1 ONNX model using the script in the models folder
  7. Update the MobileNet-V1 ONNX model to use version 11 ops
  8. Navigate to the build folder for MobileNet-V1 and start the docker container with the command:
    $FINN_ROOT/run-docker.sh build_custom . build
  9. Allow the build to run, and once it reaches "step_create_stitched_ip" it will throw an error

Expected behavior

The verification step was expected to complete and generate a verification output file, without throwing an error.

Actual behavior

The verification step throws an error, which then causes the build to fail and not generate a verification output file.

@auphelia
Copy link
Collaborator

The issue is resolved by the merge of this PR: #1192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants