PaddleDetection的量化配置问题
Created by: TianyouChen
我装了paddle1.7版本,又重新拉了最新的PaddleDetection (release/0.2)代码, 运行指令:
python3 slim/quantization/train.py --not_quant_pattern slim_output --eval --c ./configs/ssd/ssd_mobilenet_v1_voc.yml -o max_iters=30000 save_dir=./output/mobilenetv1_slim LearningRate.base_lr=0.0001 LearningRate.schedulers="[!PiecewiseDecay {gamma: 0.1, milestones: [10000]}]" pretrain_weights=https://paddlemodels.bj.bcebos.com/object_detection/ssd_mobilenet_v1_voc.tar
出现报错信息:
2020-03-02 17:14:04,367-INFO: 4952 samples in file dataset/voc/test.txt 2020-03-02 17:14:04,368-INFO: places would be ommited when DataLoader is not iterable W0302 17:14:05.122560 16661 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 10.1, Runtime API Version: 9.0 W0302 17:14:05.126299 16661 device_context.cc:245] device: 0, cuDNN Version: 7.6. 2020-03-02 17:14:06,675-INFO: Found /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc 2020-03-02 17:14:06,675-INFO: Loading parameters from /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc... 2020-03-02 17:14:06,675-WARNING: /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] 2020-03-02 17:14:06,675-WARNING: /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] Traceback (most recent call last): File "slim/quantization/train.py", line 314, in main() File "slim/quantization/train.py", line 195, in main train_prog_quant = quant_aware(train_prog, place, config, for_test=False) File "/usr/local/lib/python3.5/dist-packages/paddleslim/quant/quanter.py", line 131, in quant_aware config = _parse_configs(config) File "/usr/local/lib/python3.5/dist-packages/paddleslim/quant/quanter.py", line 105, in _parse_configs assert isinstance(configs['quant_weight_only'], bool), KeyError: 'quant_weight_only'
缺少quant_weight_only键值? 这个键值在哪里配置的?我是在/usr/local/lib/python3.5/dist-packages/paddleslim/quant/quanter.py的_quant_config_default(line 34 )参数里加了了一行 'quant_weight_only':'True',出现如下报错,看错误应该还是一样的问题:
2020-03-02 18:32:36,324-INFO: 4952 samples in file dataset/voc/test.txt 2020-03-02 18:32:36,325-INFO: places would be ommited when DataLoader is not iterable W0302 18:32:37.145490 25355 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 10.1, Runtime API Version: 9.0 W0302 18:32:37.149606 25355 device_context.cc:245] device: 0, cuDNN Version: 7.6. 2020-03-02 18:32:38,862-INFO: Found /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc 2020-03-02 18:32:38,863-INFO: Loading parameters from /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc... 2020-03-02 18:32:38,863-WARNING: /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] 2020-03-02 18:32:38,863-WARNING: /home/chenchaocun/.cache/paddle/weights/ssd_mobilenet_v1_voc.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] Traceback (most recent call last): File "slim/quantization/train.py", line 314, in main() File "slim/quantization/train.py", line 195, in main train_prog_quant = quant_aware(train_prog, place, config, for_test=False) File "/usr/local/lib/python3.5/dist-packages/paddleslim/quant/quanter.py", line 132, in quant_aware config = _parse_configs(config) File "/usr/local/lib/python3.5/dist-packages/paddleslim/quant/quanter.py", line 107, in _parse_configs "quant_weight_only must be bool value, if set quant_weight_only True, " AssertionError: quant_weight_only must be bool value, if set quant_weight_only True, then only quantize parameters of layers which need to be quantized, and activations will not be quantized.
@willthefrog