OpenPPL / ppq

PPL Quantization Tool (PPQ) is a powerful offline neural network quantization tool.
Apache License 2.0
1.56k stars 236 forks source link

[BUG]run ppq shell python ProgramEntrance_1.py quant openvino int8 model meet the problem #485

Closed PancakeAwesome closed 1 year ago

PancakeAwesome commented 1 year ago

Describe the bug

正准备量化你的网络,检查下列设置: WORKING DIRECTORY : /mnt/mmdeploy_models/working TARGET PLATFORM : OPENVINO_INT8 NETWORK INPUTSHAPE : [1, 3, 640, 640] CALIBRATION BATCHSIZE: 16 155 File(s) Loaded. Loaded sample 0, shape: torch.Size([1, 3, 640, 640]) Loaded sample 1, shape: torch.Size([1, 3, 640, 640]) Loaded sample 2, shape: torch.Size([1, 3, 640, 640]) Loaded sample 3, shape: torch.Size([1, 3, 640, 640]) Loaded sample 4, shape: torch.Size([1, 3, 640, 640]) Batch Shape: torch.Size([16, 3, 640, 640]) [Warning] Compling Kernels... Please wait (It will take a few minutes). 网络正量化中,根据你的量化配置,这将需要一段时间: [10:28:09] PPQ Quantization Fusion Pass Running ... Finished. [10:28:09] PPQ Quantize Simplify Pass Running ... Finished. [10:28:09] PPQ Parameter Quantization Pass Running ... Finished. Calibration Progress(Phase 1): 0%| | 0/32 [00:00<?, ?it/s] Traceback (most recent call last): File "/mnt/ppq/ppq/executor/torch.py", line 536, in __forward outputs = operation_forward_func(operation, inputs, self._executing_context) File "/mnt/ppq/ppq/executor/op/torch/default.py", line 759, in Reshape_forward return data.reshape(shape) RuntimeError: shape '[1, 12, 320, 320]' is invalid for input of size 19660800

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "ProgramEntrance_1.py", line 95, in quantized = quantize_native_model( File "/mnt/ppq/ppq/core/defs.py", line 54, in _wrapper return func(*args, kwargs) File "/mnt/ppq/ppq/api/interface.py", line 530, in quantize_native_model quantizer.quantize( File "/mnt/ppq/ppq/core/defs.py", line 54, in _wrapper return func(args, kwargs) File "/mnt/ppq/ppq/quantization/quantizer/base.py", line 69, in quantize quant_pipeline.optimize( File "/mnt/ppq/ppq/quantization/optim/base.py", line 81, in optimize optim_pass.optimize(graph=graph, kwargs) File "/mnt/ppq/ppq/core/defs.py", line 54, in _wrapper return func(args, kwargs) File "/mnt/ppq/ppq/quantization/optim/calibration.py", line 176, in optimize self.calibrate(desc='Calibration Progress(Phase 1)', dataloader=dataloader, File "/mnt/ppq/ppq/quantization/optim/calibration.py", line 117, in calibrate executor.forward(inputs=data, hooks=hooks, File "/opt/conda/envs/torch2/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decoratecontext return func(*args, **kwargs) File "/mnt/ppq/ppq/executor/torch.py", line 405, in forward return self.forward( File "/mnt/ppq/ppq/executor/torch.py", line 563, in forward raise RuntimeError(f'Op Execution Error: {str(operation)}') from RuntimeError: Op Execution Error: /backbone/stem/Reshape_1(Type: Reshape, Num of Input: 2, Num of Output: 1)

To Reproduce

The command you executed.

python ProgramEntrance_1.py

Post related information

PyTorch: 2.0.1 cu116 ppq 0.6.6

Additional context [here]

  1. my input model is onnx, which input shape is [1,3,640,640] and my data all are [1,3,640,640] but i meet the error log show some data is not match this shape. why?
  2. my input model is mmyolo::yolox_s, onnx fp [here]
ZhangZhiPku commented 1 year ago

哥你这个here,它不对啊

PancakeAwesome commented 1 year ago

哥你这个here,它不对啊

怎么说 哥们

ZhangZhiPku commented 1 year ago

你这here他点不进去啊