Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Operation' object has no attribute 'config' #262

Closed
kaizhong2021 opened this issue Oct 9, 2022 · 14 comments
Closed

AttributeError: 'Operation' object has no attribute 'config' #262

kaizhong2021 opened this issue Oct 9, 2022 · 14 comments

Comments

@kaizhong2021
Copy link

Traceback (most recent call last):
File "ProgramEntrance.py", line 200, in
export_ppq_graph(
File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/api/interface.py", line 628, in export_ppq_graph
exporter.export(file_path=graph_save_to, config_path=config_save_to, graph=graph, **kwargs)
File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/parser/trt_exporter.py", line 53, in export
self.export_quantization_config(config_path, graph)
File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/parser/trt_exporter.py", line 29, in export_quantization_config
input_cfg = op.config.input_quantization_config[0]
AttributeError: 'Operation' object has no attribute 'config'
在ProgramEntrance.py中调用trt_int8出错,但是调用PPL_CUDA_INT8却没有这个问题

@ZhangZhiPku
Copy link
Collaborator

让我来研究一下

@kaizhong2021
Copy link
Author

嗯嗯,谢谢志佬~

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 10, 2022

嗯嗯,谢谢志佬~

这个是因为在量化的过程中某个op没有量化参数,你的模型方便发过来看下吗?

@kaizhong2021
Copy link
Author

嗯嗯,我是用的mmdeploy,将模型导出,然后放到ppq上面跑,我用的命令是这个
python ./tools/deploy.py
configs/mmseg/segmentation_tensorrt_static-512x1024.py
$PATH_TO_MMSEG/configs/pspnet/pspnet_r18-d8_512x1024_80k_cityscapes.py
$PATH_TO_MMSEG/checkpoints/pspnet_r18-d8_512x1024_80k_cityscapes_20201225_021458-09ffa746.pth
$PATH_TO_MMSEG/demo/demo.png
--work-dir WORK_DIR/
--device cuda:0
--show
--dump-info
但是会有这样的提示
[10/09/2022-20:21:49] [TRT] [I] Post Processing Calibration data in 3.71404 seconds.
[10/09/2022-20:21:49] [TRT] [I] Calibration completed in 95.2916 seconds.
[10/09/2022-20:21:49] [TRT] [I] Writing Calibration Cache for calibrator: TRT-8401-EntropyCalibration2
[10/09/2022-20:21:49] [TRT] [W] Missing scale and zero-point for tensor onnx::Softmax_341, expect fall back to non-int8 implementation for any layer consuming or producing given tensor
[10/09/2022-20:21:49] [TRT] [W] Missing scale and zero-point for tensor onnx::Transpose_342, expect fall back to non-int8 implementation for any layer consuming or producing given tensor
[10/09/2022-20:21:49] [TRT] [I] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU +10, now: CPU 2942, GPU 2453 (MiB)
[10/09/2022-20:21:49] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +8, now: CPU 2942, GPU 2461 (MiB)
[10/09/2022-20:21:49] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.3.2
[10/09/2022-20:21:49] [TRT] [I] Local timing cache in use. Profiling results in this builder pass will not be stored.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:14] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:14] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:14] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:14] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:14] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:14] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [I] Some tactics do not have sufficient workspace memory to run. Increasing workspace size will enable more tactics, please check verbose output for requested sizes.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:31] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:31] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:31] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:40] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:40] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:40] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:40] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16:
[10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected.
[10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value.
[10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights.
[10/09/2022-20:22:44] [TRT] [I] Detected 1 inputs and 1 output network tensors.
[10/09/2022-20:22:44] [TRT] [I] Total Host Persistent Memory: 65088
[10/09/2022-20:22:44] [TRT] [I] Total Device Persistent Memory: 0
[10/09/2022-20:22:44] [TRT] [I] Total Scratch Memory: 19922944
[10/09/2022-20:22:44] [TRT] [I] [MemUsageStats] Peak memory usage of TRT CPU/GPU memory allocators: CPU 36 MiB, GPU 599 MiB
[10/09/2022-20:22:44] [TRT] [I] [BlockAssignment] Algorithm ShiftNTopDown took 1.20686ms to assign 8 blocks to 52 nodes requiring 62915584 bytes.
[10/09/2022-20:22:44] [TRT] [I] Total Activation Memory: 62915584
[10/09/2022-20:22:44] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in building engine: CPU +12, GPU +13, now: CPU 12, GPU 13 (MiB)
[10/09/2022-20:22:44] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
[10/09/2022-20:22:44] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 10, 2022

嗯嗯,我是用的mmdeploy,将模型导出,然后放到ppq上面跑,我用的命令是这个 python ./tools/deploy.py configs/mmseg/segmentation_tensorrt_static-512x1024.py $PATH_TO_MMSEG/configs/pspnet/pspnet_r18-d8_512x1024_80k_cityscapes.py $PATH_TO_MMSEG/checkpoints/pspnet_r18-d8_512x1024_80k_cityscapes_20201225_021458-09ffa746.pth $PATH_TO_MMSEG/demo/demo.png --work-dir WORK_DIR/ --device cuda:0 --show --dump-info 但是会有这样的提示 [10/09/2022-20:21:49] [TRT] [I] Post Processing Calibration data in 3.71404 seconds. [10/09/2022-20:21:49] [TRT] [I] Calibration completed in 95.2916 seconds. [10/09/2022-20:21:49] [TRT] [I] Writing Calibration Cache for calibrator: TRT-8401-EntropyCalibration2 [10/09/2022-20:21:49] [TRT] [W] Missing scale and zero-point for tensor onnx::Softmax_341, expect fall back to non-int8 implementation for any layer consuming or producing given tensor [10/09/2022-20:21:49] [TRT] [W] Missing scale and zero-point for tensor onnx::Transpose_342, expect fall back to non-int8 implementation for any layer consuming or producing given tensor [10/09/2022-20:21:49] [TRT] [I] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU +10, now: CPU 2942, GPU 2453 (MiB) [10/09/2022-20:21:49] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +8, now: CPU 2942, GPU 2461 (MiB) [10/09/2022-20:21:49] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.3.2 [10/09/2022-20:21:49] [TRT] [I] Local timing cache in use. Profiling results in this builder pass will not be stored. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:13] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:13] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:13] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:14] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:14] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:14] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:14] [TRT] [W] Weights [name=Conv_20 + Add_21 + Relu_22.weight] had the following issues when converted to FP16: [10/09/2022-20:22:14] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:14] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [I] Some tactics do not have sufficient workspace memory to run. Increasing workspace size will enable more tactics, please check verbose output for requested sizes. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:19] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:19] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:19] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:20] [TRT] [W] Weights [name=Conv_31 + Add_32 + Relu_33.weight] had the following issues when converted to FP16: [10/09/2022-20:22:20] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:20] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:30] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:30] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:30] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:31] [TRT] [W] Weights [name=Conv_45 + Relu_46.weight] had the following issues when converted to FP16: [10/09/2022-20:22:31] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:31] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:40] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:40] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:40] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:40] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:41] [TRT] [W] Weights [name=Conv_82 + Relu_83.weight] had the following issues when converted to FP16: [10/09/2022-20:22:41] [TRT] [W] - Subnormal FP16 values detected. [10/09/2022-20:22:41] [TRT] [W] - Values less than smallest positive FP16 Subnormal value detected. Converting to FP16 minimum subnormalized value. [10/09/2022-20:22:41] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to reduce the magnitude of the weights. [10/09/2022-20:22:44] [TRT] [I] Detected 1 inputs and 1 output network tensors. [10/09/2022-20:22:44] [TRT] [I] Total Host Persistent Memory: 65088 [10/09/2022-20:22:44] [TRT] [I] Total Device Persistent Memory: 0 [10/09/2022-20:22:44] [TRT] [I] Total Scratch Memory: 19922944 [10/09/2022-20:22:44] [TRT] [I] [MemUsageStats] Peak memory usage of TRT CPU/GPU memory allocators: CPU 36 MiB, GPU 599 MiB [10/09/2022-20:22:44] [TRT] [I] [BlockAssignment] Algorithm ShiftNTopDown took 1.20686ms to assign 8 blocks to 52 nodes requiring 62915584 bytes. [10/09/2022-20:22:44] [TRT] [I] Total Activation Memory: 62915584 [10/09/2022-20:22:44] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in building engine: CPU +12, GPU +13, now: CPU 12, GPU 13 (MiB) [10/09/2022-20:22:44] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1. [10/09/2022-20:22:44] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.

你是要量化tenserrt模型吗?建议把mmdeploy的中间结果onnx保存下来,然后用ppq来做量化,有问题可以联系我们

@kaizhong2021
Copy link
Author

是的,有保存下来正准备量化你的网络,检查下列设置:
WORKING DIRECTORY : working
TARGET PLATFORM : TRT_INT8
NETWORK INPUTSHAPE : [1, 3, 512, 1024]
CALIBRATION BATCHSIZE: 1
64 File(s) Loaded.
Loaded sample 0, shape: torch.Size([1, 3, 512, 1024])
Loaded sample 1, shape: torch.Size([1, 3, 512, 1024])
Loaded sample 2, shape: torch.Size([1, 3, 512, 1024])
Loaded sample 3, shape: torch.Size([1, 3, 512, 1024])
Loaded sample 4, shape: torch.Size([1, 3, 512, 1024])
Batch Shape: torch.Size([1, 3, 512, 1024])
[Warning] Compling Kernels... Please wait (It will take a few minutes).
网络正量化中,根据你的量化配置,这将需要一段时间:
[16:24:35] PPQ Quantization Config Refine Pass Running ... Finished.
[16:24:35] PPQ Quantization Fusion Pass Running ... Finished.
[16:24:35] PPQ Quantize Simplify Pass Running ... Finished.
[16:24:35] PPQ Parameter Quantization Pass Running ... Finished.
Calibration Progress(Phase 1): 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:01<00:00, 20.77it/s]
Finished.
[16:24:36] PPQ Quantization Alignment Pass Running ... Finished.
[16:24:36] PPQ Passive Parameter Quantization Running ... Finished.
[16:24:36] PPQ LSQ Optimization Running ...
Check following parameters:
Is Scale Trainable: True
Interested Layers: []
Collecting Device: cuda
Num of blocks: 17
Learning Rate: 1e-05
Steps: 500
Gamma: 0.0

Block [1 / 17]: [Conv_2 -> MaxPool_6]

/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/torch/optim/adam.py:90: UserWarning: optimizer contains a parameter group with duplicate parameters; in future, this will cause an error; see github.com/pytorch/pytorch/issues/40967 for more information
super(Adam, self).init(params, defaults)

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 180.57it/s]

Tuning Finished : (0.0004 -> 0.0003) [Block Loss]

Block [2 / 17]: [Conv_7 -> Conv_9]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:01<00:00, 407.28it/s]

Tuning Finished : (0.0003 -> 0.0003) [Block Loss]

Block [3 / 17]: [Conv_12 -> Conv_14]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:01<00:00, 408.50it/s]

Tuning Finished : (0.0004 -> 0.0004) [Block Loss]

Block [4 / 17]: [Conv_17 -> Conv_19]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 594.49it/s]

Tuning Finished : (0.0004 -> 0.0004) [Block Loss]

Block [5 / 17]: [Conv_20 -> Conv_20]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1235.16it/s]

Tuning Finished : (0.0002 -> 0.0002) [Block Loss]

Block [6 / 17]: [Conv_23 -> Conv_25]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 562.64it/s]

Tuning Finished : (0.0005 -> 0.0004) [Block Loss]

Block [7 / 17]: [Conv_28 -> Conv_30]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:01<00:00, 292.34it/s]

Tuning Finished : (0.0004 -> 0.0003) [Block Loss]

Block [8 / 17]: [Conv_31 -> Conv_31]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1207.17it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [9 / 17]: [Conv_34 -> Conv_36]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 236.83it/s]

Tuning Finished : (0.0006 -> 0.0004) [Block Loss]

Block [10 / 17]: [Conv_39 -> Conv_41]

Tuning Procedure : 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:05<00:00, 88.46it/s]

Tuning Finished : (0.0053 -> 0.0023) [Block Loss]

Block [11 / 17]: [Conv_42 -> Conv_42]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 637.11it/s]

Tuning Finished : (0.0011 -> 0.0010) [Block Loss]

Block [12 / 17]: [Conv_47 -> Conv_47]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 185.00it/s]

Tuning Finished : (0.0038 -> 0.0028) [Block Loss]

Block [13 / 17]: [Conv_51 -> Relu_52]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1144.64it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [14 / 17]: [Conv_61 -> Relu_62]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1165.95it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [15 / 17]: [Conv_68 -> Relu_69]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1156.99it/s]

Tuning Finished : (0.0001 -> 0.0000) [Block Loss]

Block [16 / 17]: [Conv_75 -> Relu_76]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1169.28it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [17 / 17]: [Conv_84 -> Resize_88]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 216.09it/s]

Tuning Finished : (0.0097 -> 0.0089) [Block Loss]

Finished.
[16:25:28] PPQ Passive Parameter Quantization Running ... Finished.
[16:25:28] PPQ Parameter Baking Pass Running ... Finished.
--------- Network Snapshot ---------
Num of Op: [90]
Num of Quantized Op: [71]
Num of Variable: [177]
Num of Quantized Var: [139]
------- Quantization Snapshot ------
Num of Quant Config: [219]
BAKED: [25]
OVERLAPPED: [83]
SLAVE: [28]
ACTIVATED: [43]
SOI: [15]
PASSIVE_BAKED: [25]
Network Quantization Finished.
正计算网络量化误差(SNR),最后一层的误差应小于 0.1 以保证量化精度:
Analysing Graphwise Quantization Error(Phrase 1):: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:01<00:00, 29.46it/s]
Analysing Graphwise Quantization Error(Phrase 2):: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:01<00:00, 26.59it/s]
Layer | NOISE:SIGNAL POWER RATIO
Conv_51: | ████████████████████ | 0.010134
Conv_20: | █████████████ | 0.006979
Conv_42: | ███████████ | 0.006235
Conv_30: | ██████████ | 0.005924
Conv_19: | █████████ | 0.005546
Conv_75: | █████████ | 0.005418
Conv_41: | █████████ | 0.005298
Conv_25: | ████████ | 0.005165
Conv_47: | ████████ | 0.005111
Conv_31: | ████████ | 0.004965
Conv_36: | ████████ | 0.004849
Conv_17: | ███████ | 0.004621
Conv_61: | ███████ | 0.004548
Conv_9: | ██████ | 0.004348
Conv_14: | ██████ | 0.004270
Conv_28: | █████ | 0.003946
Conv_68: | █████ | 0.003745
Conv_12: | ████ | 0.003296
Conv_39: | ████ | 0.003269
Conv_34: | ███ | 0.002834
Conv_23: | ███ | 0.002815
Conv_4: | ██ | 0.002477
Conv_7: | █ | 0.002158
Conv_2: | | 0.001765
Conv_84: | | 0.001608
正计算逐层量化误差(SNR),每一层的独立量化误差应小于 0.1 以保证量化精度:
Analysing Layerwise quantization error:: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25/25 [00:10<00:00, 2.46it/s]
Layer | NOISE:SIGNAL POWER RATIO
Conv_47: | ████████████████████ | 0.001576
Conv_39: | ██████████████████ | 0.001464
Conv_19: | ███████████████ | 0.001237
Conv_28: | █████████████ | 0.001099
Conv_34: | ██████████ | 0.000883
Conv_84: | █████████ | 0.000842
Conv_30: | ████████ | 0.000726
Conv_42: | ███████ | 0.000681
Conv_36: | ███████ | 0.000665
Conv_17: | ███████ | 0.000658
Conv_23: | ███████ | 0.000655
Conv_4: | █████ | 0.000575
Conv_41: | █████ | 0.000561
Conv_20: | █████ | 0.000511
Conv_7: | ████ | 0.000495
Conv_25: | ████ | 0.000486
Conv_2: | ████ | 0.000462
Conv_31: | ████ | 0.000453
Conv_75: | ████ | 0.000449
Conv_14: | ███ | 0.000408
Conv_9: | ███ | 0.000396
Conv_12: | ██ | 0.000353
Conv_68: | █ | 0.000278
Conv_61: | | 0.000227
Conv_51: | | 0.000197
网络量化结束,正在生成目标文件:
[Warning] File working/quant_cfg.json is already existed, Exporter will overwrite it.
Traceback (most recent call last):
File "ProgramEntrance.py", line 201, in
export_ppq_graph(
File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/api/interface.py", line 628, in export_ppq_graph
exporter.export(file_path=graph_save_to, config_path=config_save_to, graph=graph, **kwargs)
File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/parser/trt_exporter.py", line 53, in export
self.export_quantization_config(config_path, graph)
File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/parser/trt_exporter.py", line 29, in export_quantization_config
input_cfg = op.config.input_quantization_config[0]
AttributeError: 'Operation' object has no attribute 'config'

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 10, 2022

是的,有保存下来正准备量化你的网络,检查下列设置: WORKING DIRECTORY : working TARGET PLATFORM : TRT_INT8 NETWORK INPUTSHAPE : [1, 3, 512, 1024] CALIBRATION BATCHSIZE: 1 64 File(s) Loaded. Loaded sample 0, shape: torch.Size([1, 3, 512, 1024]) Loaded sample 1, shape: torch.Size([1, 3, 512, 1024]) Loaded sample 2, shape: torch.Size([1, 3, 512, 1024]) Loaded sample 3, shape: torch.Size([1, 3, 512, 1024]) Loaded sample 4, shape: torch.Size([1, 3, 512, 1024]) Batch Shape: torch.Size([1, 3, 512, 1024]) [Warning] Compling Kernels... Please wait (It will take a few minutes). 网络正量化中,根据你的量化配置,这将需要一段时间: [16:24:35] PPQ Quantization Config Refine Pass Running ... Finished. [16:24:35] PPQ Quantization Fusion Pass Running ... Finished. [16:24:35] PPQ Quantize Simplify Pass Running ... Finished. [16:24:35] PPQ Parameter Quantization Pass Running ... Finished. Calibration Progress(Phase 1): 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:01<00:00, 20.77it/s] Finished. [16:24:36] PPQ Quantization Alignment Pass Running ... Finished. [16:24:36] PPQ Passive Parameter Quantization Running ... Finished. [16:24:36] PPQ LSQ Optimization Running ... Check following parameters: Is Scale Trainable: True Interested Layers: [] Collecting Device: cuda Num of blocks: 17 Learning Rate: 1e-05 Steps: 500 Gamma: 0.0

Block [1 / 17]: [Conv_2 -> MaxPool_6]

/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/torch/optim/adam.py:90: UserWarning: optimizer contains a parameter group with duplicate parameters; in future, this will cause an error; see github.com/pytorch/pytorch/issues/40967 for more information super(Adam, self).init(params, defaults)

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 180.57it/s]

Tuning Finished : (0.0004 -> 0.0003) [Block Loss]

Block [2 / 17]: [Conv_7 -> Conv_9]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:01<00:00, 407.28it/s]

Tuning Finished : (0.0003 -> 0.0003) [Block Loss]

Block [3 / 17]: [Conv_12 -> Conv_14]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:01<00:00, 408.50it/s]

Tuning Finished : (0.0004 -> 0.0004) [Block Loss]

Block [4 / 17]: [Conv_17 -> Conv_19]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 594.49it/s]

Tuning Finished : (0.0004 -> 0.0004) [Block Loss]

Block [5 / 17]: [Conv_20 -> Conv_20]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1235.16it/s]

Tuning Finished : (0.0002 -> 0.0002) [Block Loss]

Block [6 / 17]: [Conv_23 -> Conv_25]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 562.64it/s]

Tuning Finished : (0.0005 -> 0.0004) [Block Loss]

Block [7 / 17]: [Conv_28 -> Conv_30]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:01<00:00, 292.34it/s]

Tuning Finished : (0.0004 -> 0.0003) [Block Loss]

Block [8 / 17]: [Conv_31 -> Conv_31]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1207.17it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [9 / 17]: [Conv_34 -> Conv_36]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 236.83it/s]

Tuning Finished : (0.0006 -> 0.0004) [Block Loss]

Block [10 / 17]: [Conv_39 -> Conv_41]

Tuning Procedure : 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:05<00:00, 88.46it/s]

Tuning Finished : (0.0053 -> 0.0023) [Block Loss]

Block [11 / 17]: [Conv_42 -> Conv_42]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 637.11it/s]

Tuning Finished : (0.0011 -> 0.0010) [Block Loss]

Block [12 / 17]: [Conv_47 -> Conv_47]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 185.00it/s]

Tuning Finished : (0.0038 -> 0.0028) [Block Loss]

Block [13 / 17]: [Conv_51 -> Relu_52]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1144.64it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [14 / 17]: [Conv_61 -> Relu_62]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1165.95it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [15 / 17]: [Conv_68 -> Relu_69]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1156.99it/s]

Tuning Finished : (0.0001 -> 0.0000) [Block Loss]

Block [16 / 17]: [Conv_75 -> Relu_76]

Tuning Procedure : 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:00<00:00, 1169.28it/s]

Tuning Finished : (0.0001 -> 0.0001) [Block Loss]

Block [17 / 17]: [Conv_84 -> Resize_88]

Tuning Procedure : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 500/500 [00:02<00:00, 216.09it/s]

Tuning Finished : (0.0097 -> 0.0089) [Block Loss]

Finished. [16:25:28] PPQ Passive Parameter Quantization Running ... Finished. [16:25:28] PPQ Parameter Baking Pass Running ... Finished. --------- Network Snapshot --------- Num of Op: [90] Num of Quantized Op: [71] Num of Variable: [177] Num of Quantized Var: [139] ------- Quantization Snapshot ------ Num of Quant Config: [219] BAKED: [25] OVERLAPPED: [83] SLAVE: [28] ACTIVATED: [43] SOI: [15] PASSIVE_BAKED: [25] Network Quantization Finished. 正计算网络量化误差(SNR),最后一层的误差应小于 0.1 以保证量化精度: Analysing Graphwise Quantization Error(Phrase 1):: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:01<00:00, 29.46it/s] Analysing Graphwise Quantization Error(Phrase 2):: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:01<00:00, 26.59it/s] Layer | NOISE:SIGNAL POWER RATIO Conv_51: | ████████████████████ | 0.010134 Conv_20: | █████████████ | 0.006979 Conv_42: | ███████████ | 0.006235 Conv_30: | ██████████ | 0.005924 Conv_19: | █████████ | 0.005546 Conv_75: | █████████ | 0.005418 Conv_41: | █████████ | 0.005298 Conv_25: | ████████ | 0.005165 Conv_47: | ████████ | 0.005111 Conv_31: | ████████ | 0.004965 Conv_36: | ████████ | 0.004849 Conv_17: | ███████ | 0.004621 Conv_61: | ███████ | 0.004548 Conv_9: | ██████ | 0.004348 Conv_14: | ██████ | 0.004270 Conv_28: | █████ | 0.003946 Conv_68: | █████ | 0.003745 Conv_12: | ████ | 0.003296 Conv_39: | ████ | 0.003269 Conv_34: | ███ | 0.002834 Conv_23: | ███ | 0.002815 Conv_4: | ██ | 0.002477 Conv_7: | █ | 0.002158 Conv_2: | | 0.001765 Conv_84: | | 0.001608 正计算逐层量化误差(SNR),每一层的独立量化误差应小于 0.1 以保证量化精度: Analysing Layerwise quantization error:: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25/25 [00:10<00:00, 2.46it/s] Layer | NOISE:SIGNAL POWER RATIO Conv_47: | ████████████████████ | 0.001576 Conv_39: | ██████████████████ | 0.001464 Conv_19: | ███████████████ | 0.001237 Conv_28: | █████████████ | 0.001099 Conv_34: | ██████████ | 0.000883 Conv_84: | █████████ | 0.000842 Conv_30: | ████████ | 0.000726 Conv_42: | ███████ | 0.000681 Conv_36: | ███████ | 0.000665 Conv_17: | ███████ | 0.000658 Conv_23: | ███████ | 0.000655 Conv_4: | █████ | 0.000575 Conv_41: | █████ | 0.000561 Conv_20: | █████ | 0.000511 Conv_7: | ████ | 0.000495 Conv_25: | ████ | 0.000486 Conv_2: | ████ | 0.000462 Conv_31: | ████ | 0.000453 Conv_75: | ████ | 0.000449 Conv_14: | ███ | 0.000408 Conv_9: | ███ | 0.000396 Conv_12: | ██ | 0.000353 Conv_68: | █ | 0.000278 Conv_61: | | 0.000227 Conv_51: | | 0.000197 网络量化结束,正在生成目标文件: [Warning] File working/quant_cfg.json is already existed, Exporter will overwrite it. Traceback (most recent call last): File "ProgramEntrance.py", line 201, in export_ppq_graph( File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/api/interface.py", line 628, in export_ppq_graph exporter.export(file_path=graph_save_to, config_path=config_save_to, graph=graph, **kwargs) File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/parser/trt_exporter.py", line 53, in export self.export_quantization_config(config_path, graph) File "/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq/parser/trt_exporter.py", line 29, in export_quantization_config input_cfg = op.config.input_quantization_config[0] AttributeError: 'Operation' object has no attribute 'config'

在ppq/ppq/parser/trt_exporter.py的第26行加: print(op.name) 然后再跑一次,看看是哪个op没有写量化参数

@kaizhong2021
Copy link
Author

嗯嗯,谢谢大佬

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 10, 2022

嗯嗯,谢谢大佬

有结果了吗?

@kaizhong2021
Copy link
Author

  ____  ____  __   ____                    __              __
 / __ \/ __ \/ /  / __ \__  ______ _____  / /_____  ____  / /
/ /_/ / /_/ / /  / / / / / / / __ `/ __ \/ __/ __ \/ __ \/ /

/ / / /__/ // / // / // / / / / // // / // / /
/
/ /
/ /___,/_,// //_/_/__//

using ppq: ['/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq']
Traceback (most recent call last):
File "trt_exporter.py", line 9, in
from .caffe_exporter import CaffeExporter
ImportError: attempted relative import with no known parent package
佬这个trt_exporter 为啥要引入caffe呀?

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 11, 2022

  ____  ____  __   ____                    __              __
 / __ \/ __ \/ /  / __ \__  ______ _____  / /_____  ____  / /
/ /_/ / /_/ / /  / / / / / / / __ `/ __ \/ __/ __ \/ __ \/ /

/ / / /__/ // / // / // / / / / // // / // / / // // /****,/,// /_///___//

using ppq: ['/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq'] Traceback (most recent call last): File "trt_exporter.py", line 9, in from .caffe_exporter import CaffeExporter ImportError: attempted relative import with no known parent package 佬这个trt_exporter 为啥要引入caffe呀?

你把 /root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq 卸载了(pip uninstall ppq)

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 11, 2022

  ____  ____  __   ____                    __              __
 / __ \/ __ \/ /  / __ \__  ______ _____  / /_____  ____  / /
/ /_/ / /_/ / /  / / / / / / / __ `/ __ \/ __/ __ \/ __ \/ /

/ / / /__/ // / // / // / / / / // // / // / / // // /****,/,// /_///___//

using ppq: ['/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq'] Traceback (most recent call last): File "trt_exporter.py", line 9, in from .caffe_exporter import CaffeExporter ImportError: attempted relative import with no known parent package 佬这个trt_exporter 为啥要引入caffe呀?

重新git clone,用最新的master分支来跑

@Lenan22
Copy link
Contributor

Lenan22 commented Oct 12, 2022

  ____  ____  __   ____                    __              __
 / __ \/ __ \/ /  / __ \__  ______ _____  / /_____  ____  / /
/ /_/ / /_/ / /  / / / / / / / __ `/ __ \/ __/ __ \/ __ \/ /

/ / / /__/ // / // / // / / / / // // / // / / // // /****,/,// /_///___//

using ppq: ['/root/miniconda3/envs/mmdeploy/lib/python3.8/site-packages/ppq-0.6.5.1-py3.8.egg/ppq'] Traceback (most recent call last): File "trt_exporter.py", line 9, in from .caffe_exporter import CaffeExporter ImportError: attempted relative import with no known parent package 佬这个trt_exporter 为啥要引入caffe呀?

这个引入caffe是因为有些用户输入的是caffe模型,尝试了新的分支了吗?现在还有问题吗?

@kaizhong2021
Copy link
Author

尝试新的分支了,已经解决啦,谢谢大佬耐心的解答~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants