Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM icon indicating copy to clipboard operation
Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM copied to clipboard

RuntimeError: ONNX export failed: Couldn't export Python operator SwishImplementation

Open nutsam opened this issue 4 years ago • 7 comments

I ran your convert to onnx code and had error like title, can you help?

nutsam avatar May 13 '20 08:05 nutsam

@nutsam you need set EfficientSwish false like that

murdockhou avatar May 14 '20 02:05 murdockhou

Yes, I used your code and has that line already, but still error.

nutsam avatar May 14 '20 02:05 nutsam

Are you sure you are using the original code and not change anywhere? It's weird if you not change code but occur this error. The env that I use is:

  • ubuntu 16.04
  • cuda 10.1
  • cudnn 7.6
  • pytorch 1.4

nutsam [email protected] 于2020年5月14日周四 上午10:08写道:

Yes, I used your code and has that line already, but still error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/murdockhou/Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM/issues/6#issuecomment-628342468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMCC7JUKIWDTRYUJF2FX5DRRNHCJANCNFSM4M7RQM7Q .

murdockhou avatar May 14 '20 04:05 murdockhou

@nutsam Have you solved this problem? I encounter the same problem with you.

Beam-wi avatar May 28 '20 11:05 Beam-wi

@nutsam 知道了,作者在 EfficientDetBackbone 中实例化 BiFPN,Regressor,Classifier时没有传onnx_export参数,加进去就行了

Beam-wi avatar May 28 '20 13:05 Beam-wi

@Beam-wi may I ask which code and exactly where should we insert "onnx_export" into?

swchew avatar Aug 12 '20 08:08 swchew

If you print the model (print(model)), you can debug in which parts of the code still have the MemoryEfficientSwish.

In my case, my model had the backbone (efficient net) and the detector wrapped, so when I loaded the set_swish after the loaded model or if I used the flag to initialize the model and then load the weights, flag onnx_export didn't update the layer. So, I had to fix it manually as the following code:

heitorrapela avatar Oct 08 '21 21:10 heitorrapela