PaddleSlim
PaddleSlim copied to clipboard
量化示例报错(quant_aware_with_infermodel)
paddleslim版本:develop
跑的demo:https://github.com/PaddlePaddle/PaddleSlim/tree/develop/demo/quant/quant_aware_with_infermodel 唯一改动:--use_pact=True改为了--use_pact=False
报错信息: ----------- Configuration Arguments ----------- batch_size: 512 checkpoint_path: ./MobileNetV2_quantaware_ckpt/ distill_node_name_list: ['teacher_linear_1.tmp_0', 'linear_1.tmp_0'] learning_rate: 0.0001 model_path_prefix: ./pretrain/MobileNetV2_infer/inference num_epoch: 1 save_iter_step: 100 teacher_model_path_prefix: ./pretrain/MobileNetV2_infer/inference use_gpu: 1 use_pact: False weight_decay: 4e-05
2023-05-10 15:52:12,605-INFO: quant_aware config {'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max', 'weight_bits': 8, 'activation_bits': 8, 'not_quant_pattern': ['skip_quant'], 'quantize_op_types': ['conv2d', 'depthwise_conv2d', 'mul'], 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9, 'for_tensorrt': False, 'is_full_quantize': False, 'onnx_format': True, 'quant_post_first': False, 'scale_trainable': True, 'deploy_backend': None, 'quant_config': <paddle.static.quantization.quant_config.BaseQuantizer object at 0x7f0458e4bc18>} I0510 15:52:12.890381 167726 interpretercore.cc:267] New Executor is Running. W0510 15:52:12.896950 167726 gpu_resources.cc:90] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 10.2, Runtime API Version: 10.2 W0510 15:52:12.900543 167726 gpu_resources.cc:120] device: 0, cuDNN Version: 7.6. 2023-05-10 15:52:17,043-INFO: train config.distill_node_pair: ['teacher_linear_1.tmp_0', 'linear_1.tmp_0'] 2023-05-10 15:52:17,319-INFO: quant_aware config {'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max', 'weight_bits': 8, 'activation_bits': 8, 'not_quant_pattern': ['skip_quant'], 'quantize_op_types': ['conv2d', 'depthwise_conv2d', 'mul'], 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9, 'for_tensorrt': False, 'is_full_quantize': False, 'onnx_format': True, 'quant_post_first': False, 'scale_trainable': True, 'deploy_backend': None, 'quant_config': <paddle.static.quantization.quant_config.BaseQuantizer object at 0x7f0458d40c50>} Adding quant op with weight:|██████████████████████████████████████████| 159/159 Adding quant activation op:|███████████████████████████████████████████| 371/371 Adding OutScale op:|███████████████████████████████████████████████████| 158/158 2023-05-10 15:52:19,853-INFO: quant_aware config {'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max', 'weight_bits': 8, 'activation_bits': 8, 'not_quant_pattern': ['skip_quant'], 'quantize_op_types': ['conv2d', 'depthwise_conv2d', 'mul'], 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9, 'for_tensorrt': False, 'is_full_quantize': False, 'onnx_format': True, 'quant_post_first': False, 'scale_trainable': True, 'deploy_backend': None, 'quant_config': <paddle.static.quantization.quant_config.BaseQuantizer object at 0x7f0458886fd0>} Adding quant op with weight:|██████████████████████████████████████████| 651/651 Adding quant activation op:|███████████████████████████████████████████| 863/863 Adding OutScale op:|███████████████████████████████████████████████████| 321/321 /home/xuweixiang/local/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py:1229: UserWarning: The variable x is not found in program. It is not declared or is pruned. Traceback (most recent call last): File "quant_aware_with_infermodel.py", line 149, in
main() File "quant_aware_with_infermodel.py", line 144, in main quantize(args) File "quant_aware_with_infermodel.py", line 137, in quantize test_callback=test_callback) File "../../../paddleslim/quant/quant_aware_with_infermodel.py", line 219, in quant_aware_with_infermodel fetch_list=train_fetch_list) File "/home/xuweixiang/local/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1435, in run use_prune=use_prune, File "/home/xuweixiang/local/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1659, in run_impl scope, list(feed.keys()), fetch_list, return_numpy File "/home/xuweixiang/local/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 655, in run scope, feed_names, fetch_list RuntimeError: (PreconditionNotMet) Tensor holds no memory. Call Tensor::mutable_data firstly. [Hint: holder should not be null.] (at /paddle/paddle/phi/core/dense_tensor_impl.cc:44) [operator < quantize_linear > error]
抱歉未能及时回复,能否提供更多paddle相关代码库的版本信息