您好,我参考J5工具链的QAT参考算法模型示例自己量化SSD模型,在指定stage为calibration运行train.py的过程中,遇到如下两个问题:
当calibration_trainer中的activation_calibration_observer选择mse算法时,首先在/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/quantization/observer_v2.py中的_compute_scale_symmetric函数下会报错RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!,我在报错的部分使用xxx=xxx.cuda()统一设备后,报错RuntimeError: [16:23:14] /home/jenkins/agent/torch1130_cu116_py38/3rdparty/hbdnn/include/hbdnn/utils.h:283: Check failed: (Device::kDevMask) == (dev_type == kDLCPU ? mshadow::cpu::kDevMask : mshadow::gpu::kDevMask),请问这个设备错误信息是什么原因?
- 当calibration_trainer中的activation_calibration_observer选择min_max算法时,不会出现上述设备信息报错,但是报错TypeError: The input should be QTensor, but got <class 'torch.Tensor'>, please make sure the qconfig is set correctly.Users can use the QuantStub to quantize a tensor directly.但是我在模型类内的forward函数开始已经写了x=quant(x),末尾也写了x=dequant(x),且在模型类内也写了如下的qconfig函数。请问还有哪里需要修改?谢谢!

