×

签到

分享到微信

打开微信,使用扫一扫进入页面后,点击右上角菜单,

点击“发送给朋友”或“分享到朋友圈”完成分享

yolov5模型量化问题 已解决 FrostLee2023-02-01 18:20:23 回复 8 查看 技术答疑 使用求助
yolov5模型量化问题
分享到:

【寒武纪硬件产品型号】必填*:MLU220


【使用操作系统】必填*:Ubuntu 18.04.5 LTS 


【使用驱动版本】必填*:CNRT: 4.10.2 adb709e


【问题】:yolov5模型量化出现问题,报错信息如下,没明白是什么错误,求助大佬!!!!


【出错信息】必填*:

python mlu_forward.py --weight quan_unzip.pt --cfg yolov5s.yaml --offline --fusion

CNML: 7.9.110 6984825

CNRT: 4.7.7 7970522

2023-02-01 18:05:35.446263: [cnrtWarning] [389674] [Card : NONE] Failed to initialize CNDEV. Host manage interface disabled 

2023-02-01 18:05:35.448696: [cnrtError] [389674] [Card : NONE] No MLU can be found !

2023-02-01 18:05:35.448719: [cnmlError] No MLU device

2023-02-01 18:05:35.448893: [cnmlError] No MLU device

/torch/venv3/pytorch/lib/python3.6/site-packages/pandas/compat/__init__.py:120: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.

  warnings.warn(msg)

/torch/venv3/pytorch/lib/python3.6/site-packages/torch/_utils.py:155: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).

  scales = torch.tensor(scales, dtype=torch.float64)

/torch/venv3/pytorch/lib/python3.6/site-packages/torch/_utils.py:156: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).

  zero_points = torch.tensor(zero_points, dtype=torch.int64)


Traceback (most recent call last):

  File "mlu_forward.py", line 337, in <module>

    quantification( opt.img, mlu220 = save_offline_model)

  File "mlu_forward.py", line 174, in quantification

    model.load_state_dict(state_dict, strict=False)  # load

  File "/torch/venv3/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 839, in load_state_dict

    self.__class__.__name__, "\n\t".join(error_msgs)))

RuntimeError: Error(s) in loading state_dict for Model:

While copying the parameter named "model.0.conv.weight", whose dimensions in the model are torch.Size([32, 3, 6, 6]) and whose dimensions in the checkpoint are torch.Size([32, 3, 6, 6]).

While copying the parameter named "model.1.conv.weight", whose dimensions in the model are torch.Size([64, 32, 3, 3]) and whose dimensions in the checkpoint are torch.Size([64, 32, 3, 3]).

While copying the parameter named "model.2.cv1.conv.weight", whose dimensions in the model are torch.Size([32, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([32, 64, 1, 1]).

While copying the parameter named "model.2.cv2.conv.weight", whose dimensions in the model are torch.Size([32, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([32, 64, 1, 1]).

While copying the parameter named "model.2.cv3.conv.weight", whose dimensions in the model are torch.Size([64, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 64, 1, 1]).

While copying the parameter named "model.2.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([32, 32, 1, 1]) and whose dimensions in the checkpoint are torch.Size([32, 32, 1, 1]).

While copying the parameter named "model.2.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([32, 32, 3, 3]) and whose dimensions in the checkpoint are torch.Size([32, 32, 3, 3]).

While copying the parameter named "model.3.conv.weight", whose dimensions in the model are torch.Size([128, 64, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 64, 3, 3]).

While copying the parameter named "model.4.cv1.conv.weight", whose dimensions in the model are torch.Size([64, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 128, 1, 1]).

While copying the parameter named "model.4.cv2.conv.weight", whose dimensions in the model are torch.Size([64, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 128, 1, 1]).

While copying the parameter named "model.4.cv3.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.4.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([64, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 64, 1, 1]).

While copying the parameter named "model.4.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([64, 64, 3, 3]) and whose dimensions in the checkpoint are torch.Size([64, 64, 3, 3]).

While copying the parameter named "model.4.m.1.cv1.conv.weight", whose dimensions in the model are torch.Size([64, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 64, 1, 1]).

While copying the parameter named "model.4.m.1.cv2.conv.weight", whose dimensions in the model are torch.Size([64, 64, 3, 3]) and whose dimensions in the checkpoint are torch.Size([64, 64, 3, 3]).

While copying the parameter named "model.5.conv.weight", whose dimensions in the model are torch.Size([256, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([256, 128, 3, 3]).

While copying the parameter named "model.6.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 256, 1, 1]).

While copying the parameter named "model.6.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 256, 1, 1]).

While copying the parameter named "model.6.cv3.conv.weight", whose dimensions in the model are torch.Size([256, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 256, 1, 1]).

While copying the parameter named "model.6.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.6.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 128, 3, 3]).

While copying the parameter named "model.6.m.1.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.6.m.1.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 128, 3, 3]).

While copying the parameter named "model.6.m.2.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.6.m.2.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 128, 3, 3]).

While copying the parameter named "model.7.conv.weight", whose dimensions in the model are torch.Size([512, 256, 3, 3]) and whose dimensions in the checkpoint are torch.Size([512, 256, 3, 3]).

While copying the parameter named "model.8.cv1.conv.weight", whose dimensions in the model are torch.Size([256, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 512, 1, 1]).

While copying the parameter named "model.8.cv2.conv.weight", whose dimensions in the model are torch.Size([256, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 512, 1, 1]).

While copying the parameter named "model.8.cv3.conv.weight", whose dimensions in the model are torch.Size([512, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([512, 512, 1, 1]).

While copying the parameter named "model.8.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([256, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 256, 1, 1]).

While copying the parameter named "model.8.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([256, 256, 3, 3]) and whose dimensions in the checkpoint are torch.Size([256, 256, 3, 3]).

While copying the parameter named "model.9.cv1.conv.weight", whose dimensions in the model are torch.Size([256, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 512, 1, 1]).

While copying the parameter named "model.9.cv2.conv.weight", whose dimensions in the model are torch.Size([512, 1024, 1, 1]) and whose dimensions in the checkpoint are torch.Size([512, 1024, 1, 1]).

While copying the parameter named "model.10.conv.weight", whose dimensions in the model are torch.Size([256, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 512, 1, 1]).

While copying the parameter named "model.13.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 512, 1, 1]).

While copying the parameter named "model.13.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 512, 1, 1]).

While copying the parameter named "model.13.cv3.conv.weight", whose dimensions in the model are torch.Size([256, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 256, 1, 1]).

While copying the parameter named "model.13.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.13.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 128, 3, 3]).

While copying the parameter named "model.14.conv.weight", whose dimensions in the model are torch.Size([128, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 256, 1, 1]).

While copying the parameter named "model.17.cv1.conv.weight", whose dimensions in the model are torch.Size([64, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 256, 1, 1]).

While copying the parameter named "model.17.cv2.conv.weight", whose dimensions in the model are torch.Size([64, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 256, 1, 1]).

While copying the parameter named "model.17.cv3.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.17.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([64, 64, 1, 1]) and whose dimensions in the checkpoint are torch.Size([64, 64, 1, 1]).

While copying the parameter named "model.17.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([64, 64, 3, 3]) and whose dimensions in the checkpoint are torch.Size([64, 64, 3, 3]).

While copying the parameter named "model.18.conv.weight", whose dimensions in the model are torch.Size([128, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 128, 3, 3]).

While copying the parameter named "model.20.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 256, 1, 1]).

While copying the parameter named "model.20.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 256, 1, 1]).

While copying the parameter named "model.20.cv3.conv.weight", whose dimensions in the model are torch.Size([256, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 256, 1, 1]).

While copying the parameter named "model.20.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([128, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([128, 128, 1, 1]).

While copying the parameter named "model.20.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([128, 128, 3, 3]) and whose dimensions in the checkpoint are torch.Size([128, 128, 3, 3]).

While copying the parameter named "model.21.conv.weight", whose dimensions in the model are torch.Size([256, 256, 3, 3]) and whose dimensions in the checkpoint are torch.Size([256, 256, 3, 3]).

While copying the parameter named "model.23.cv1.conv.weight", whose dimensions in the model are torch.Size([256, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 512, 1, 1]).

While copying the parameter named "model.23.cv2.conv.weight", whose dimensions in the model are torch.Size([256, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 512, 1, 1]).

While copying the parameter named "model.23.cv3.conv.weight", whose dimensions in the model are torch.Size([512, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([512, 512, 1, 1]).

While copying the parameter named "model.23.m.0.cv1.conv.weight", whose dimensions in the model are torch.Size([256, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([256, 256, 1, 1]).

While copying the parameter named "model.23.m.0.cv2.conv.weight", whose dimensions in the model are torch.Size([256, 256, 3, 3]) and whose dimensions in the checkpoint are torch.Size([256, 256, 3, 3]).

While copying the parameter named "model.24.m.0.weight", whose dimensions in the model are torch.Size([21, 128, 1, 1]) and whose dimensions in the checkpoint are torch.Size([21, 128, 1, 1]).

While copying the parameter named "model.24.m.1.weight", whose dimensions in the model are torch.Size([21, 256, 1, 1]) and whose dimensions in the checkpoint are torch.Size([21, 256, 1, 1]).

While copying the parameter named "model.24.m.2.weight", whose dimensions in the model are torch.Size([21, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([21, 512, 1, 1]).

版权所有 © 2024 寒武纪 Cambricon.com 备案/许可证号:京ICP备17003415号-1
关闭