ZouJiu1 / LSQplus

LSQ+ or LSQplus
57 stars 14 forks source link

I have a question about LSQ , LSQ+ model device embedding #13

Open minkyukang707 opened 1 year ago

minkyukang707 commented 1 year ago

I've tried to convert LSQ, LSQ+ model to ONNX model but I got a runtime error

This is the code what I tried to run

import torch from brevitas.export import export_onnx_qcdq

export_onnx_qcdq(quantized_model, torch.randn(2048,52).cuda(), exportpath='lsq+.onnx')

here is the error message that I got from converting LSQ+ model to onnx First error line "name": "RuntimeError", "message": "ONNX export failed: Couldn't export Python operator ALSQPlus\n\nDefined at:\ne:\LSQplus-master\LSQplus-master\quantization\lsqplus_quantize_V2.py(154):

Last error lines e:\LSQplus-master\LSQplus-master\quantization\lsqplus_quantize_V2.py:154:0\n %onnx::Gemm_67 : Float(, , strides=[16, 1], requires_grad=0, device=cuda:0) = ^WLSQPlus(0.007394637578467616, -128, 127, False)(%model_fp32.output.0.weight, %model_fp32.output.0.weight_quantizer.s) # e:\LSQplus-master\LSQplus-master\quantization\lsqplus_quantize_V2.py:221:0\n %68 : Float(, , strides=[9, 1], requires_grad=0, device=cuda:0) = onnx::Gemm[alpha=1., beta=1., transB=1](%onnx::Gemm_66, %onnx::Gemm_67, %model_fp32.output.0.bias) # e:\LSQplus-master\LSQplus-master\quantization\lsqplus_quantize_V2.py:319:0\n return (%68)\n" }

Have you ever tried this before? or It isn't supported from onnx itself? I wonder about it