finn icon indicating copy to clipboard operation
finn copied to clipboard

OPSET and Assuming 4D input is NCHW

Open Ba1tu3han opened this issue 1 year ago • 1 comments

Prerequisites

Please make sure to check off these prerequisites before submitting a bug report.

  • [+] Test that the bug appears on the current version of the dev-branch. Make sure to include the commit hash of the commit you checked out.
  • [+] Check that the issue hasn't already been reported, by checking the currently open issues.
  • [ ] If there are steps to reproduce the problem, make sure to write them down below.
  • [+] If relevant, please include the ONNX files, which were created directly before and/or after the bug.

Quick summary

I trained Brevitas CNV model on CIFAR10 dataset by using QAT and exported it by this scpript

from brevitas.export import export_qonnx
input_tensor = torch.randn(batch_size, n_channel, shape_x, shape_y).to(device)
export_qonnx(model, input_tensor, export_path='QONNX_CNV.onnx')

Then, imported it to tfc_end2end_example.ipynb

Unfortunately, I have encountered with warnings and errors:

image image

Details

QONNX File QONNX_CNV.zip

Brevitas

Brevitas: 0.10.2 Ubuntu: 20.04 Python: 3.10.12 Torch: 2.1.0 CUDA: 12.2

FINN

FINN: 0.10 (tag: dev_latest) Docker: 25.0.1 Vivado: 2022.1 Vitis HLS: 2022.1 Ubuntu: 20.04 Python: 3.11.5

Error:

AssertionError: MultiThreshold_6: Signed output requres actval < 0

Possible fix

Using an extra convertion or a setting

Ba1tu3han avatar Feb 25 '24 17:02 Ba1tu3han

@auphelia could you help me about that?

I follow cnv_end2end_example notebook. I can implement W1A1 version that I trained CNV by Brevitas succesfully in Pynq-Z2. However I just change quantization from 1 bit to 2 bits, I have this issue. Where should I look?

I have checked similar github issues but I could not find a solution.

Bests,

Ba1tu3han avatar Aug 27 '24 19:08 Ba1tu3han