PaddleSlim icon indicating copy to clipboard operation
PaddleSlim copied to clipboard

ValueError: Incorrect setting for output(s) of operator "unsqueeze2", should set: [XShape].

Open NutshellLee opened this issue 2 years ago • 2 comments

ValueError: Incorrect setting for output(s) of operator "unsqueeze2", should set: [XShape]. 跑yolov6s ACT自动蒸馏量化用自己的数据集,output8个类别的权重转成onnx,数据集配置成类似COCO文件格式跑的,出现这个报错什么问题?

yolov6s_v2_qat_dis.yaml里面是这样设置的:

model_dir: ./weights/best_ckpt.onnx image_path: None # If image_path is set, it will be trained directly based on unlabeled images, no need to set the COCO dataset path. coco_dataset_dir: /PaddleSlim/dataset/output/ coco_train_image_dir: /PaddleSlim/dataset/output/images/train coco_train_anno_path: /PaddleSlim/dataset/output/annotations/instances_train2017.json coco_val_image_dir: /PaddleSlim/dataset/output/images/val coco_val_anno_path: /PaddleSlim/dataset/output/annotations/instances_val2017.json

具体报错信息如下:

loading annotations into memory... Done (t=1.31s) creating index... index created! loading annotations into memory... Done (t=0.11s) creating index... index created! 2023-09-05 03:53:17,517-INFO: Loaded model from: ./weights/best_ckpt_infer W0905 03:53:17.518724 17334 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.7, Runtime API Version: 11.2 W0905 03:53:17.523062 17334 gpu_resources.cc:91] device: 0, cuDNN Version: 8.1. 2023-09-05 03:53:18,756-INFO: devices: gpu 2023-09-05 03:53:21,163-INFO: Loaded model from: ./weights/best_ckpt_infer 2023-09-05 03:53:25,687-INFO: Loaded model from: ./weights/best_ckpt_infer 2023-09-05 03:53:25,691-INFO: Selected strategies: ['qat_dis'] 2023-09-05 03:53:28,010-INFO: Loaded model from: ./weights/best_ckpt_infer 2023-09-05 03:53:30,340-INFO: Loaded model from: ./weights/best_ckpt_infer 2023-09-05 03:53:32,443-INFO: Loaded model from: ./weights/best_ckpt_infer Traceback (most recent call last): File "run.py", line 148, in main() File "run.py", line 136, in main ac.compress() File "/usr/local/lib/python3.7/site-packages/paddleslim/auto_compression/compressor.py", line 594, in compress train_config) File "/usr/local/lib/python3.7/site-packages/paddleslim/auto_compression/compressor.py", line 771, in single_strategy_compress strategy, config, train_config) File "/usr/local/lib/python3.7/site-packages/paddleslim/auto_compression/compressor.py", line 517, in _prepare_program default_distill_node_pair=self.default_distill_node_pair) File "/usr/local/lib/python3.7/site-packages/paddleslim/auto_compression/create_compressed_program.py", line 273, in build_distill_program feed_target_names=feed_target_names) File "/usr/local/lib/python3.7/site-packages/paddleslim/auto_compression/create_compressed_program.py", line 197, in _load_program_and_merge merge_feed=merge_feed) File "/usr/local/lib/python3.7/site-packages/paddleslim/dist/single_distiller.py", line 103, in merge type=op.type, inputs=inputs, outputs=outputs, attrs=attrs) File "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 4023, in append_op attrs=kwargs.get("attrs", None), File "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2953, in init % (type, m.name) ValueError: Incorrect setting for output(s) of operator "unsqueeze2", should set: [XShape].

NutshellLee avatar Sep 05 '23 04:09 NutshellLee

产出模型用的paddle版本和使用自动压缩加载的paddle版本相同嘛?

ceci3 avatar Feb 06 '24 05:02 ceci3

试一下Paddle2.5和PaddeSlim2.5呢

lizexu123 avatar Feb 06 '24 16:02 lizexu123