Open maiquanshen opened 2 years ago
@maiquanshen 你是要转换成在MKLDNN上部署的量化模型吗?
@maiquanshen 你是要转换成在MKLDNN上部署的量化模型吗?
@yghstill 是的。检测模型ch_PP-OCRv3_det_slim_infer是可以成功转换的,识别模型就出现上面的问题了
@yghstill 你好,请问这个问题我该怎么解决呢
@yghstill 你好,请问这个问题我该怎么解决呢 蹲一个后续。。
@lizexu123
量化后的模型,不需要转,就可以在mkldnn上进行部署的
python3.7 tools/save_quant_model.py --quant_model_path=./ch_PP-OCRv3_rec_slim_infer --quant_model_filename=inference.pdmodel --quant_params_filename=inference.pdiparams --int8_model_save_path=./ch_PP-OCRv3_rec_slim_infer/int8
--- Fused 0 subgraphs into layer_norm op. --- fused 0 pairs of fc lstm patterns --- fused 0 pairs of fc gru patterns --- fused 0 pairs of concatenated multi_gru ops --- fused 0 sequences of two multi_gru ops I1125 11:40:53.991871 16871 fuse_pass_base.cc:57] --- detected 9 subgraphs I1125 11:40:53.998540 16871 fuse_pass_base.cc:57] --- detected 4 subgraphs I1125 11:40:54.034428 16871 fuse_pass_base.cc:57] --- detected 13 subgraphs I1125 11:40:54.091616 16871 fuse_pass_base.cc:57] --- detected 32 subgraphs I1125 11:40:54.115307 16871 fuse_pass_base.cc:57] --- detected 4 subgraphs --- Fused 0 projection conv (as y) + elementwise_add patterns --- Fused 0 conv (as x) + elementwise_add patterns --- Fused 0 conv (as y) + elementwise_add patterns I1125 11:40:54.141652 16871 fuse_pass_base.cc:57] --- detected 2 subgraphs W1125 11:40:54.157826 16871 op_compat_sensible_pass.cc:207] Attribute(beta) of Op(swish) is not defined in opProto or is in extra set!The compatable check for this attribute is not use. Please remove it from the precondition of pass: conv_swish_mkldnn_fuse_pass I1125 11:40:54.158461 16871 fuse_pass_base.cc:57] --- detected 5 subgraphs I1125 11:40:54.169867 16871 fuse_pass_base.cc:57] --- detected 27 subgraphs I1125 11:40:54.179919 16871 fuse_pass_base.cc:57] --- detected 2 subgraphs I1125 11:40:54.191304 16871 fuse_pass_base.cc:57] --- detected 9 subgraphs I1125 11:40:54.201628 16871 fuse_pass_base.cc:57] --- detected 9 subgraphs --- fused 0 fc with gelu activation --- fused 0 fc with tanh activation --- fused 0 fc with sigmoid activation --- fused 0 fc with mish activation --- fused 0 fc with hard_swish activation I1125 11:40:54.209825 16871 fuse_pass_base.cc:57] --- detected 2 subgraphs --- Fused 2 MatmulTransposeReshape patterns for matmul Op --- Fused 0 MatmulTransposeReshape patterns for matmul_v2 Op --- fused 0 batch norm with relu activation --- fused 0 softplus with relu activation --- fused 0 softplus with tanh activation --- fused 0 softplus with leaky_relu activation --- fused 0 softplus with swish activation --- fused 0 softplus with hardswish activation --- fused 0 softplus with sqrt activation --- fused 0 softplus with abs activation --- fused 0 softplus with clip activation --- fused 0 softplus with gelu activation --- fused 0 softplus with relu6 activation --- fused 0 softplus with sigmoid activation /root/anaconda3/envs/paddlex/lib/python3.7/site-packages/paddle/fluid/contrib/slim/quantization/quant2_int8_mkldnn_pass.py:524: RuntimeWarning: divide by zero encountered in true_divide axis=axis) I1125 11:40:54.283635 16871 fuse_pass_base.cc:57] --- detected 2 subgraphs --- fused 2 scale with matmul --- Fused 0 ReshapeTransposeMatmul patterns for matmul Op --- Fused 0 ReshapeTransposeMatmul patterns for matmul Op with transpose's xshape --- Fused 0 ReshapeTransposeMatmul patterns for matmul Op with reshape's xshape --- Fused 0 ReshapeTransposeMatmul patterns for matmul Op with reshape's xshape with transpose's xshape --- Fused 0 ReshapeTransposeMatmul patterns for matmul_v2 Op --- Fused 0 ReshapeTransposeMatmul patterns for matmul_v2 Op with transpose's xshape --- Fused 0 ReshapeTransposeMatmul patterns for matmul_v2 Op with reshape's xshape --- Fused 0 ReshapeTransposeMatmul patterns for matmul_v2 Op with reshape's xshape with transpose's xshape I1125 11:40:54.311667 16871 fuse_pass_base.cc:57] --- detected 36 subgraphs --- quantized 36 conv2d ops --- quantized 0 conv2d ops with residual connection --- quantized 0 pool2d ops I1125 11:40:54.314494 16871 fuse_pass_base.cc:57] --- detected 1 subgraphs --- quantized 1 concat ops --- quantized 0 prior_box ops I1125 11:40:54.317961 16871 fuse_pass_base.cc:57] --- detected 6 subgraphs --- quantized 6 transpose2 ops I1125 11:40:54.319792 16871 fuse_pass_base.cc:57] --- detected 9 subgraphs --- quantized 9 fc ops I1125 11:40:54.322600 16871 fuse_pass_base.cc:57] --- detected 3 subgraphs --- quantized 3 reshape2 ops I1125 11:40:54.328544 16871 fuse_pass_base.cc:57] --- detected 2 subgraphs --- quantized 2 matmul ops --- quantized 0 elementwise_add ops --- quantized 0 elementwise_mul ops --- quantized 0 fusion_gru ops --- quantized 0 multi_gru ops --- quantized 0 fusion_lstm ops I1125 11:40:54.332952 16871 fuse_pass_base.cc:57] --- detected 6 subgraphs --- quantized 6 slice ops --- quantized 0 nearest_interp ops --- squashed 0 scale with dequantize op --- squashed 0 scale with quantize op I1125 11:40:54.350023 16871 fuse_pass_base.cc:57] --- detected 65 subgraphs I1125 11:40:54.373798 16871 fuse_pass_base.cc:57] --- detected 49 subgraphs --- squashed 49 dequantize-quantize pairs I1125 11:40:54.374718 16871 fuse_pass_base.cc:57] --- detected 1 subgraphs --- squashed 1 requantize ops --- squashed 0 requantize ops I1125 11:40:54.377631 16871 fuse_pass_base.cc:57] --- detected 12 subgraphs --- squashed 12 dequant with ops I1125 11:40:54.377813 16871 fuse_pass_base.cc:57] --- detected 1 subgraphs --- squashed 0 quantize op --- squashed 0 quantize with bfloat16 conv2d op Traceback (most recent call last): File "tools/save_quant_model.py", line 155, in test_args.save_model_filename, test_args.save_params_filename) File "tools/save_quant_model.py", line 142, in transform_and_save_int8_model params_filename=save_params_filename) File "</root/anaconda3/lib/python3.7/site-packages/decorator.py:decorator-gen-123>", line 2, in save_inference_model File "/root/anaconda3/envs/paddlex/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in impl return wrapped_func(*args, *kwargs) File "/root/anaconda3/envs/paddlex/lib/python3.7/site-packages/paddle/fluid/framework.py", line 443, in impl return func(args, **kwargs) File "/root/anaconda3/envs/paddlex/lib/python3.7/site-packages/paddle/fluid/io.py", line 1432, in save_inference_model prepend_feed_ops(main_program, feeded_var_names) File "/root/anaconda3/envs/paddlex/lib/python3.7/site-packages/paddle/fluid/io.py", line 1218, in prepend_feed_ops i=i, name=name)) ValueError: The feeded_var_names[0]: 'x' doesn't exist in pruned inference program. Please check whether 'x' is a valid feed_var name, or remove it from feeded_var_names if 'x' is not involved in the target_vars calculation.
请问是哪里的问题没能转换成功呢