Skip to content

Error during verification after step_qonnx_to_finn #1484

@filippouxry

Description

@filippouxry

Quick summary

I am trying to follow the build process using an autoencoder model trained using Pytorch in this notebook samples/onnx_accelerator_sample1/notebooks/02 - Training with Pytorch.ipynb as part of a larger project. I pass the resulting model through the Brevitas PTQ process in order to quantize to 8-bits and then feed it to the FINN flow . During the first step, step_qonnx_to_finn, I come across "Could not extract bias from node" warnings for each Conv and ConvTranspose node in the network, and then during the verification process with python after this step, the build fails with an ONNXRuntimeError.

Details

I have verified the model's functionality and accuracy after the Brevitas PTQ process.
This is the model that i feed to the FINN flow :

Image

The intermediate model after step_qonnx_to_finn is not saved.

This is the output of the overall build:

Image

and these are the contents of the build_dataflow.log:

Image

this refers to the first Conv node and is repeated for the other two, and the same warning shows up for all the ConvTranspose nodes like so :

Image

Steps to Reproduce

  1. Clone the FINN repository
  2. Checkout the dev branch, with commit hash: [5d51eec]
  3. Start the docker container with the command.
  4. Run the dataflow builder standard steps with the following config:
Image

Expected behavior

The first step should convert the input .onnx model into a finn-dialect model suitable for further transformations and save it in the intermediate models folder. Also an output file should be saved in the verification output folder .

Actual behavior

The build fails due to the above error, not having saved the model after the qonnx_to_finn tranformation.

Optional

Possible fix

I have looked through existing issues and haven't found a definitive answer or solution, though there is mention of the same warnings ("Could not extract bias bias from node") I get in this issue comment : https://github.com/Xilinx/finn/issues/855#issuecomment-2072120388
I believe these warnings could play an important role to this functional problem down the line.

Additional context

If I skip the verification of step_qonnx_to_finn the build continues , though during the step_set_fifo_depths an error about folded shape mismatch occurred, and i had to write a custom step to alter the dilation of a ConvolutionInputGenerator layer in order for the build to finish. In this case, when testing the accelerator on a ZCU104 device, it's output was all zeros.

Any help on this would be greatly appreciated, feel free to ask for any other context needed!

UPDATE

Having by-passed verification in step_qonnx_to_finn, I managed to perform verification after my custom streamline step obtaining good enough results, but only after adding a patch in extract_conv_bias.py .

I noticed that during bias extraction the tensor_name that was looked up in the graph initializers for each Conv node was something like "Quant_2_out0" whereas the initializers included "Quant_2_param0" instead.
This is the patch I added in extract_conv_bias.py, to force the lookup of the correct (?) names:

Image

and these are the steps I follow as well as the custom streamlining step:

Image Image

Unfortunately, I can't seem to perform verification further down the process after custom_step_convert_to_hw:

Image

because of this error:

Image

which, I have pinpointed, refers to the MVAU of the first ConvTranspose layer. This is the model after hw conversion:

Image

@auphelia , @hleblevec , @fpjentzsch I would really appreciate any advice on this, I think the problem could be some misalignment during a transformation (or a redundant transformation?) , possibly because the lowering of the convs happens during streamlining while the lowering of convTranspose nodes happens during conversion to hw?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions