PPL Quantization Tool (PPQ) is a powerful offline neural network quantization tool.
Apache License 2.0
1.57k
stars
236
forks
source link
PPQ yolov5-7.0 :return torch.cat(concat_view, axis=axis) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 28 but got size 27 for tensor number 1 in the list. #520
python ProgramEntrance_1.py
正准备量化你的网络,检查下列设置:
WORKING DIRECTORY : working
TARGET PLATFORM : TRT_INT8
NETWORK INPUTSHAPE : [1, 3, 640, 640]
CALIBRATION BATCHSIZE: 16
[Warning] 你的输入图像似乎包含动态的尺寸,因此 CALIBRATION BATCHSIZE 被强制设置为 1
123 File(s) Loaded.
Loaded sample 0, shape: torch.Size([1, 3, 426, 640])
Loaded sample 1, shape: torch.Size([1, 3, 640, 360])
Loaded sample 2, shape: torch.Size([1, 3, 480, 640])
Loaded sample 3, shape: torch.Size([1, 3, 480, 640])
Loaded sample 4, shape: torch.Size([1, 3, 425, 640])
Batch Shape: torch.Size([1, 3, 426, 640])
[Warning] Compling Kernels... Please wait (It will take a few minutes).
网络正量化中,根据你的量化配置,这将需要一段时间:
[12:16:08] PPQ Quantization Fusion Pass Running ... Finished.
[12:16:08] PPQ Quantize Simplify Pass Running ... Finished.
[12:16:08] PPQ Parameter Quantization Pass Running ... Finished.
Calibration Progress(Phase 1): 0%| | 0/32 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/torch.py", line 536, in __forward
outputs = operation_forward_func(operation, inputs, self._executing_context)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/op/torch/default.py", line 901, in Concat_forward
return torch.cat(concat_view, axis=axis)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 28 but got size 27 for tensor number 1 in the list.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ProgramEntrance_1.py", line 98, in
quantized = quantize_native_model(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/core/defs.py", line 54, in _wrapper
return func(*args, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/api/interface.py", line 530, in quantize_native_model
quantizer.quantize(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/core/defs.py", line 54, in _wrapper
return func(args, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/quantizer/base.py", line 69, in quantize
quant_pipeline.optimize(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/optim/base.py", line 81, in optimize
optim_pass.optimize(graph=graph, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/core/defs.py", line 54, in _wrapper
return func(args, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/optim/calibration.py", line 176, in optimize
self.calibrate(desc='Calibration Progress(Phase 1)', dataloader=dataloader,
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/optim/calibration.py", line 117, in calibrate
executor.forward(inputs=data, hooks=hooks,
File "/home/yellen/miniconda3/envs/ppq/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decoratecontext
return func(*args, **kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/torch.py", line 405, in forward
return self.forward(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/torch.py", line 563, in forward
raise RuntimeError(f'Op Execution Error: {str(operation)}') from
RuntimeError: Op Execution Error: Concat_168(Type: Concat, Num of Input: 2, Num of Output: 1)
python ProgramEntrance_1.py 正准备量化你的网络,检查下列设置: WORKING DIRECTORY : working TARGET PLATFORM : TRT_INT8 NETWORK INPUTSHAPE : [1, 3, 640, 640] CALIBRATION BATCHSIZE: 16 [Warning] 你的输入图像似乎包含动态的尺寸,因此 CALIBRATION BATCHSIZE 被强制设置为 1 123 File(s) Loaded. Loaded sample 0, shape: torch.Size([1, 3, 426, 640]) Loaded sample 1, shape: torch.Size([1, 3, 640, 360]) Loaded sample 2, shape: torch.Size([1, 3, 480, 640]) Loaded sample 3, shape: torch.Size([1, 3, 480, 640]) Loaded sample 4, shape: torch.Size([1, 3, 425, 640]) Batch Shape: torch.Size([1, 3, 426, 640]) [Warning] Compling Kernels... Please wait (It will take a few minutes). 网络正量化中,根据你的量化配置,这将需要一段时间: [12:16:08] PPQ Quantization Fusion Pass Running ... Finished. [12:16:08] PPQ Quantize Simplify Pass Running ... Finished. [12:16:08] PPQ Parameter Quantization Pass Running ... Finished. Calibration Progress(Phase 1): 0%| | 0/32 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/torch.py", line 536, in __forward outputs = operation_forward_func(operation, inputs, self._executing_context) File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/op/torch/default.py", line 901, in Concat_forward return torch.cat(concat_view, axis=axis) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 28 but got size 27 for tensor number 1 in the list.
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/yellen/run/proj/03-zz-PPQ/ppq/ProgramEntrance_1.py", line 98, in
quantized = quantize_native_model(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/core/defs.py", line 54, in _wrapper
return func(*args, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/api/interface.py", line 530, in quantize_native_model
quantizer.quantize(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/core/defs.py", line 54, in _wrapper
return func(args, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/quantizer/base.py", line 69, in quantize
quant_pipeline.optimize(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/optim/base.py", line 81, in optimize
optim_pass.optimize(graph=graph, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/core/defs.py", line 54, in _wrapper
return func(args, kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/optim/calibration.py", line 176, in optimize
self.calibrate(desc='Calibration Progress(Phase 1)', dataloader=dataloader,
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/quantization/optim/calibration.py", line 117, in calibrate
executor.forward(inputs=data, hooks=hooks,
File "/home/yellen/miniconda3/envs/ppq/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decoratecontext
return func(*args, **kwargs)
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/torch.py", line 405, in forward
return self.forward(
File "/home/yellen/run/proj/03-zz-PPQ/ppq/ppq/executor/torch.py", line 563, in forward
raise RuntimeError(f'Op Execution Error: {str(operation)}') from
RuntimeError: Op Execution Error: Concat_168(Type: Concat, Num of Input: 2, Num of Output: 1)