rockchip-linux / rknn-toolkit

BSD 3-Clause "New" or "Revised" License
818 stars 174 forks source link

pytorch qat模型转rknn模型报错 KeyError: 'scale' #467

Open CuberFan opened 2 months ago

CuberFan commented 2 months ago

pytorch:1.10.0 rknn_toolkit: 1.7.5 转换环境:官方1.7.5的docker

错误: E Catch exception when loading pytorch model: ./ocr_ht_waferlabel/resnet18v1_ocr_det_qat_script_best.pt! E Traceback (most recent call last): E File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 131, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 5245, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.load E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 5419, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.parse_nets E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 5033, in rknn.base.RKNNlib.converter.convert_pytorch_new.PyTorchOpConverter.convert_operators E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 4673, in rknn.base.RKNNlib.converter.convert_pytorch_new.PyTorchOpConverter.quantized_linear E KeyError: 'scale' E Please feedback the detailed log file to the RKNN Toolkit development team. E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues

相同的模型,1.7.3的docker转换没有任何报错,用1.7.5的docker报上面的错误 KeyError: 'scale'

pytorch 1.9.0 + rknn toolkit 1.7.5,同样报上述错误。

基本可以确定是rknn toolkit 1.7.5的 bug

jxx-xi commented 2 months ago

发个模型来验证一下吧

CuberFan commented 2 months ago

发个模型来验证一下吧

好的,现在上传模型。 [Uploading model.zip…]()