PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.29k stars 5.61k forks source link

Export Quantitative Model ValueError: The additional config (onnx_format) of `paddle.jit.save` is not supported. #53515

Closed wynswd1210qq closed 1 year ago

wynswd1210qq commented 1 year ago

请提出你的问题 Please ask your question

[2023/05/05 11:14:23] ppocr INFO: Architecture : [2023/05/05 11:14:23] ppocr INFO: Models : [2023/05/05 11:14:23] ppocr INFO: Student : [2023/05/05 11:14:23] ppocr INFO: Backbone : [2023/05/05 11:14:23] ppocr INFO: disable_se : True [2023/05/05 11:14:23] ppocr INFO: model_name : large [2023/05/05 11:14:23] ppocr INFO: name : MobileNetV3 [2023/05/05 11:14:23] ppocr INFO: scale : 0.5 [2023/05/05 11:14:23] ppocr INFO: Head : [2023/05/05 11:14:23] ppocr INFO: k : 50 [2023/05/05 11:14:23] ppocr INFO: name : DBHead [2023/05/05 11:14:23] ppocr INFO: Neck : [2023/05/05 11:14:23] ppocr INFO: name : RSEFPN [2023/05/05 11:14:23] ppocr INFO: out_channels : 96 [2023/05/05 11:14:23] ppocr INFO: shortcut : True [2023/05/05 11:14:23] ppocr INFO: Transform : None [2023/05/05 11:14:23] ppocr INFO: algorithm : DB [2023/05/05 11:14:23] ppocr INFO: model_type : det [2023/05/05 11:14:23] ppocr INFO: pretrained : None [2023/05/05 11:14:23] ppocr INFO: Student2 : [2023/05/05 11:14:23] ppocr INFO: Backbone : [2023/05/05 11:14:23] ppocr INFO: disable_se : True [2023/05/05 11:14:23] ppocr INFO: model_name : large [2023/05/05 11:14:23] ppocr INFO: name : MobileNetV3 [2023/05/05 11:14:23] ppocr INFO: scale : 0.5 [2023/05/05 11:14:23] ppocr INFO: Head : [2023/05/05 11:14:23] ppocr INFO: k : 50 [2023/05/05 11:14:23] ppocr INFO: name : DBHead [2023/05/05 11:14:23] ppocr INFO: Neck : [2023/05/05 11:14:23] ppocr INFO: name : RSEFPN [2023/05/05 11:14:23] ppocr INFO: out_channels : 96 [2023/05/05 11:14:23] ppocr INFO: shortcut : True [2023/05/05 11:14:23] ppocr INFO: Transform : None [2023/05/05 11:14:23] ppocr INFO: algorithm : DB [2023/05/05 11:14:23] ppocr INFO: model_type : det [2023/05/05 11:14:23] ppocr INFO: pretrained : None [2023/05/05 11:14:23] ppocr INFO: Teacher : [2023/05/05 11:14:23] ppocr INFO: Backbone : [2023/05/05 11:14:23] ppocr INFO: in_channels : 3 [2023/05/05 11:14:23] ppocr INFO: layers : 50 [2023/05/05 11:14:23] ppocr INFO: name : ResNet_vd [2023/05/05 11:14:23] ppocr INFO: Head : [2023/05/05 11:14:23] ppocr INFO: k : 50 [2023/05/05 11:14:23] ppocr INFO: kernel_list : [7, 2, 2] [2023/05/05 11:14:23] ppocr INFO: name : DBHead [2023/05/05 11:14:23] ppocr INFO: Neck : [2023/05/05 11:14:23] ppocr INFO: name : LKPAN [2023/05/05 11:14:23] ppocr INFO: out_channels : 256 [2023/05/05 11:14:23] ppocr INFO: algorithm : DB [2023/05/05 11:14:23] ppocr INFO: freeze_params : True [2023/05/05 11:14:23] ppocr INFO: model_type : det [2023/05/05 11:14:23] ppocr INFO: return_all_feats : False [2023/05/05 11:14:23] ppocr INFO: algorithm : Distillation [2023/05/05 11:14:23] ppocr INFO: model_type : det [2023/05/05 11:14:23] ppocr INFO: name : DistillationModel [2023/05/05 11:14:23] ppocr INFO: Eval : [2023/05/05 11:14:23] ppocr INFO: dataset : [2023/05/05 11:14:23] ppocr INFO: data_dir : ./train_data/icdar2015/text_localization/ [2023/05/05 11:14:23] ppocr INFO: label_file_list : ['./train_data/icdar2015/text_localization/test_icdar2015_label.txt'] [2023/05/05 11:14:23] ppocr INFO: name : SimpleDataSet [2023/05/05 11:14:23] ppocr INFO: transforms : [2023/05/05 11:14:23] ppocr INFO: DecodeImage : [2023/05/05 11:14:23] ppocr INFO: channel_first : False [2023/05/05 11:14:23] ppocr INFO: img_mode : BGR [2023/05/05 11:14:23] ppocr INFO: DetLabelEncode : None [2023/05/05 11:14:23] ppocr INFO: DetResizeForTest : None [2023/05/05 11:14:23] ppocr INFO: NormalizeImage : [2023/05/05 11:14:23] ppocr INFO: mean : [0.485, 0.456, 0.406] [2023/05/05 11:14:23] ppocr INFO: order : hwc [2023/05/05 11:14:23] ppocr INFO: scale : 1./255. [2023/05/05 11:14:23] ppocr INFO: std : [0.229, 0.224, 0.225] [2023/05/05 11:14:23] ppocr INFO: ToCHWImage : None [2023/05/05 11:14:23] ppocr INFO: KeepKeys : [2023/05/05 11:14:23] ppocr INFO: keep_keys : ['image', 'shape', 'polys', 'ignore_tags'] [2023/05/05 11:14:23] ppocr INFO: loader : [2023/05/05 11:14:23] ppocr INFO: batch_size_per_card : 1 [2023/05/05 11:14:23] ppocr INFO: drop_last : False [2023/05/05 11:14:23] ppocr INFO: num_workers : 2 [2023/05/05 11:14:23] ppocr INFO: shuffle : False [2023/05/05 11:14:23] ppocr INFO: Global : [2023/05/05 11:14:23] ppocr INFO: cal_metric_during_train : False [2023/05/05 11:14:23] ppocr INFO: checkpoints : output/quant_model_distill/best_accuracy [2023/05/05 11:14:23] ppocr INFO: debug : False [2023/05/05 11:14:23] ppocr INFO: distributed : False [2023/05/05 11:14:23] ppocr INFO: epoch_num : 500 [2023/05/05 11:14:23] ppocr INFO: eval_batch_step : [0, 400] [2023/05/05 11:14:23] ppocr INFO: infer_img : doc/imgs_en/img_10.jpg [2023/05/05 11:14:23] ppocr INFO: log_smooth_window : 20 [2023/05/05 11:14:23] ppocr INFO: pretrained_model : None [2023/05/05 11:14:23] ppocr INFO: print_batch_step : 10 [2023/05/05 11:14:23] ppocr INFO: save_epoch_step : 100 [2023/05/05 11:14:23] ppocr INFO: save_inference_dir : ./output/quant_inference_model [2023/05/05 11:14:23] ppocr INFO: save_model_dir : ./output/ch_PP-OCR_v3_det/ [2023/05/05 11:14:23] ppocr INFO: save_res_path : ./checkpoints/det_db/predicts_db.txt [2023/05/05 11:14:23] ppocr INFO: use_gpu : True [2023/05/05 11:14:23] ppocr INFO: use_visualdl : False [2023/05/05 11:14:23] ppocr INFO: Loss : [2023/05/05 11:14:23] ppocr INFO: loss_config_list : [2023/05/05 11:14:23] ppocr INFO: DistillationDilaDBLoss : [2023/05/05 11:14:23] ppocr INFO: alpha : 5 [2023/05/05 11:14:23] ppocr INFO: balance_loss : True [2023/05/05 11:14:23] ppocr INFO: beta : 10 [2023/05/05 11:14:23] ppocr INFO: key : maps [2023/05/05 11:14:23] ppocr INFO: main_loss_type : DiceLoss [2023/05/05 11:14:23] ppocr INFO: model_name_pairs : [['Student', 'Teacher'], ['Student2', 'Teacher']] [2023/05/05 11:14:23] ppocr INFO: ohem_ratio : 3 [2023/05/05 11:14:23] ppocr INFO: weight : 1.0 [2023/05/05 11:14:23] ppocr INFO: DistillationDMLLoss : [2023/05/05 11:14:23] ppocr INFO: key : maps [2023/05/05 11:14:23] ppocr INFO: maps_name : thrink_maps [2023/05/05 11:14:23] ppocr INFO: model_name_pairs : ['Student', 'Student2'] [2023/05/05 11:14:23] ppocr INFO: weight : 1.0 [2023/05/05 11:14:23] ppocr INFO: DistillationDBLoss : [2023/05/05 11:14:23] ppocr INFO: alpha : 5 [2023/05/05 11:14:23] ppocr INFO: balance_loss : True [2023/05/05 11:14:23] ppocr INFO: beta : 10 [2023/05/05 11:14:23] ppocr INFO: main_loss_type : DiceLoss [2023/05/05 11:14:23] ppocr INFO: model_name_list : ['Student', 'Student2'] [2023/05/05 11:14:23] ppocr INFO: ohem_ratio : 3 [2023/05/05 11:14:23] ppocr INFO: weight : 1.0 [2023/05/05 11:14:23] ppocr INFO: name : CombinedLoss [2023/05/05 11:14:23] ppocr INFO: Metric : [2023/05/05 11:14:23] ppocr INFO: base_metric_name : DetMetric [2023/05/05 11:14:23] ppocr INFO: key : Student [2023/05/05 11:14:23] ppocr INFO: main_indicator : hmean [2023/05/05 11:14:23] ppocr INFO: name : DistillationMetric [2023/05/05 11:14:23] ppocr INFO: Optimizer : [2023/05/05 11:14:23] ppocr INFO: beta1 : 0.9 [2023/05/05 11:14:23] ppocr INFO: beta2 : 0.999 [2023/05/05 11:14:23] ppocr INFO: lr : [2023/05/05 11:14:23] ppocr INFO: learning_rate : 0.001 [2023/05/05 11:14:23] ppocr INFO: name : Cosine [2023/05/05 11:14:23] ppocr INFO: warmup_epoch : 2 [2023/05/05 11:14:23] ppocr INFO: name : Adam [2023/05/05 11:14:23] ppocr INFO: regularizer : [2023/05/05 11:14:23] ppocr INFO: factor : 5e-05 [2023/05/05 11:14:23] ppocr INFO: name : L2 [2023/05/05 11:14:23] ppocr INFO: PostProcess : [2023/05/05 11:14:23] ppocr INFO: box_thresh : 0.6 [2023/05/05 11:14:23] ppocr INFO: key : head_out [2023/05/05 11:14:23] ppocr INFO: max_candidates : 1000 [2023/05/05 11:14:23] ppocr INFO: model_name : ['Student'] [2023/05/05 11:14:23] ppocr INFO: name : DistillationDBPostProcess [2023/05/05 11:14:23] ppocr INFO: thresh : 0.3 [2023/05/05 11:14:23] ppocr INFO: unclip_ratio : 1.5 [2023/05/05 11:14:23] ppocr INFO: Train : [2023/05/05 11:14:23] ppocr INFO: dataset : [2023/05/05 11:14:23] ppocr INFO: data_dir : ./train_data/icdar2015/text_localization/ [2023/05/05 11:14:23] ppocr INFO: label_file_list : ['./train_data/icdar2015/text_localization/train_icdar2015_label.txt'] [2023/05/05 11:14:23] ppocr INFO: name : SimpleDataSet [2023/05/05 11:14:23] ppocr INFO: ratio_list : [1.0] [2023/05/05 11:14:23] ppocr INFO: transforms : [2023/05/05 11:14:23] ppocr INFO: DecodeImage : [2023/05/05 11:14:23] ppocr INFO: channel_first : False [2023/05/05 11:14:23] ppocr INFO: img_mode : BGR [2023/05/05 11:14:23] ppocr INFO: DetLabelEncode : None [2023/05/05 11:14:23] ppocr INFO: CopyPaste : None [2023/05/05 11:14:23] ppocr INFO: IaaAugment : [2023/05/05 11:14:23] ppocr INFO: augmenter_args : [2023/05/05 11:14:23] ppocr INFO: args : [2023/05/05 11:14:23] ppocr INFO: p : 0.5 [2023/05/05 11:14:23] ppocr INFO: type : Fliplr [2023/05/05 11:14:23] ppocr INFO: args : [2023/05/05 11:14:23] ppocr INFO: rotate : [-10, 10] [2023/05/05 11:14:23] ppocr INFO: type : Affine [2023/05/05 11:14:23] ppocr INFO: args : [2023/05/05 11:14:23] ppocr INFO: size : [0.5, 3] [2023/05/05 11:14:23] ppocr INFO: type : Resize [2023/05/05 11:14:23] ppocr INFO: EastRandomCropData : [2023/05/05 11:14:23] ppocr INFO: keep_ratio : True [2023/05/05 11:14:23] ppocr INFO: max_tries : 50 [2023/05/05 11:14:23] ppocr INFO: size : [960, 960] [2023/05/05 11:14:23] ppocr INFO: MakeBorderMap : [2023/05/05 11:14:23] ppocr INFO: shrink_ratio : 0.4 [2023/05/05 11:14:23] ppocr INFO: thresh_max : 0.7 [2023/05/05 11:14:23] ppocr INFO: thresh_min : 0.3 [2023/05/05 11:14:23] ppocr INFO: MakeShrinkMap : [2023/05/05 11:14:23] ppocr INFO: min_text_size : 8 [2023/05/05 11:14:23] ppocr INFO: shrink_ratio : 0.4 [2023/05/05 11:14:23] ppocr INFO: NormalizeImage : [2023/05/05 11:14:23] ppocr INFO: mean : [0.485, 0.456, 0.406] [2023/05/05 11:14:23] ppocr INFO: order : hwc [2023/05/05 11:14:23] ppocr INFO: scale : 1./255. [2023/05/05 11:14:23] ppocr INFO: std : [0.229, 0.224, 0.225] [2023/05/05 11:14:23] ppocr INFO: ToCHWImage : None [2023/05/05 11:14:23] ppocr INFO: KeepKeys : [2023/05/05 11:14:23] ppocr INFO: keep_keys : ['image', 'threshold_map', 'threshold_mask', 'shrink_map', 'shrink_mask'] [2023/05/05 11:14:23] ppocr INFO: loader : [2023/05/05 11:14:23] ppocr INFO: batch_size_per_card : 4 [2023/05/05 11:14:23] ppocr INFO: drop_last : False [2023/05/05 11:14:23] ppocr INFO: num_workers : 4 [2023/05/05 11:14:23] ppocr INFO: shuffle : True [2023/05/05 11:14:23] ppocr INFO: profiler_options : None [2023/05/05 11:14:23] ppocr INFO: train with paddle 2.4.1 and device Place(gpu:0) W0505 11:14:23.218870 839301 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.7, Runtime API Version: 11.7 W0505 11:14:23.880375 839301 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4. [2023/05/05 11:14:28] ppocr INFO: resume from output/quant_model_distill/best_accuracy [2023/05/05 11:14:28] ppocr INFO: Initialize indexs of datasets:['./train_data/icdar2015/text_localization/test_icdar2015_label.txt'] eval model:: 100%|██████████████████████████████████████████████████████████████| 500/500 [03:02<00:00, 2.75it/s] [2023/05/05 11:17:30] ppocr INFO: metric eval ***** [2023/05/05 11:17:30] ppocr INFO: precision:0.5509090909090909 [2023/05/05 11:17:30] ppocr INFO: recall:0.43765045739046704 [2023/05/05 11:17:30] ppocr INFO: hmean:0.4877917896431446 [2023/05/05 11:17:30] ppocr INFO: fps:2.886090180059969 Traceback (most recent call last): File "deploy/slim/quantization/export_model.py", line 176, in main() File "deploy/slim/quantization/export_model.py", line 167, in main quanter) File "/home/ubuntu/ocr/PaddleOCR/tools/export_model.py", line 187, in export_single_model quanter.save_quantized_model(model, save_path) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddleslim/dygraph/quant/qat.py", line 293, in save_quantized_model onnx_format=onnx_format) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/contrib/slim/quantization/imperative/qat.py", line 293, in save_quantized_model config) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/contrib/slim/quantization/imperative/qat.py", line 500, in save_quantized_model paddle.jit.save(layer=model, path=path, input_spec=input_spec, config) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl return wrapped_func(args, kwargs) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/dygraph/jit.py", line 649, in wrapper func(layer, path, input_spec, configs) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/decorator.py", line 232, in fun return caller(func, (extras + args), kw) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl return wrapped_func(*args, *kwargs) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 67, in impl return func(args, kwargs) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/dygraph/jit.py", line 892, in save configs = _parse_save_configs(configs) File "/root/anaconda3/envs/paddlenlp/lib/python3.7/site-packages/paddle/fluid/dygraph/jit.py", line 393, in _parse_save_configs % (key)) ValueError: The additional config (onnx_format) of paddle.jit.save is not supported. Boss, how can we resolve this error when exporting the model

risemeup1 commented 1 year ago

你好,请你按照规范提issue,可以说下背景,原因,怎么出问题的,以及如何复现