Closed CrappyGit closed 3 years ago
It's a known issue that faster_rcnn_fbnetv3g_fpn
has issue with export/quantization, we'll update the config.
got same error NotImplementedError: Could not run 'aten::thnn_conv2d_forward' with arguments from the 'QuantizedCPU' backend.
@wat3rBro Do you have more informations on the bug location ? Is it only a configuration issue ?
The Mask-RCNN-FBNetV3G-FPN
has been fixed in https://github.com/facebookresearch/d2go/pull/102.
I forgot to update Faster-RCNN-FBNetV3G-FPN
Basically, you may change the config and retrain the model:
ROI_MASK_HEAD:
NAME: "FBNetV2RoIMaskHead"
I got a similar error when i exported Faster-RCNN-FBNetV3G-FPN model with customized COCO datasets using latest d2go version, all the other object detection models can run normally. When i tried to change the config follow the tips above, i still got this error.
Traceback (most recent call last):
File "/home/liupeng/sdb1/PythonProject/scaleDetection/detectron2go/fasterrcnn/train.py", line 114, in
@zhanghang1989 Any help would be appreciated
Do you still have this issue on master branch?
We haven't found a good way to quantize D2's Conv2d yet, so https://github.com/facebookresearch/d2go/pull/163 for the workaround.
I encountered a runtime error
RuntimeError: Could not run 'aten::thnn_conv2d_forward' with arguments from the 'QuantizedCPU' backend.
when I tried exporting a COCO object detection model. The error can be reproduced with the code shown below.The configuration file and datasets I used are customized, the full configuration can be found under the full log and datasets can be replaced by anything else. You can still reproduce this issue by just exporting the model output from
model_zoo.get_checkpoint_url("faster_rcnn_fbnetv3g_fpn.yaml")
without any further training.Note that this error only occurred when exporting Faster-RCNN-FBNetV3G-FPN model but Faster-RCNN-FBNetV3A and Faster-RCNN-FBNetV3A-dsmask can be exported smoothly.
There is a PyTorch document where common errors in quantization process are discussed. The document suggests this error is caused by passing a quantized Tensor into a non-quantized kernel and dequantization is the solution.
In my case, the class is
Conv2d
. This error however occurred after post-training quantization(ptq) which is triggered inconvert_and_export_predictor
function so I'm not sure is dequantizing Tensor after ptq making any sense. I tried addingself.dequant = torch.quantization.DeQuantStub()
andx = self.dequant(x)
intoConv2d
anyway but the result remained unchanged.Any help would be appreciated.
Instructions To Reproduce the 🐛 Bug:
The code was run on Colab and the CUDA version was changed to 10.1 by running commands shown below.
Full logs: