Results 60 comments of whs

可以参考这里:https://github.com/PaddlePaddle/PaddleSlim/tree/develop/example/auto_compression

@yghstill 辛苦看下‘moving_average_abs_max_scale’没有被删除的问题?是不是在哪个版本修复过?

你好,可以贴一下保存量化的脚本么?从log看,在保存模型前没有做convert操作。

确认了一下,不是convert的问题。 你能贴出来完整的可复现示例么?pptrtrans是哪个github repo?还是非公开的代码? 还有PaddlePaddle和PddleSlim的版本也贴一下?

@kismit 已经复现了您的问题,并在量化保存的模型中发现一个多余的op,该OP正常情况是应该被删除的,还在进一步定位原因。

fixed in https://github.com/PaddlePaddle/Paddle/pull/37681 You can find and replace `qat.py` in your `site-packages` directory of python. https://github.com/PaddlePaddle/Paddle/blob/681f46ae63821e5a6a4e8275e4415176573e692a/python/paddle/fluid/contrib/slim/quantization/imperative/qat.py

@kismit 根据上面的修改,已经确保infer model中不含`moving_average_abs_max_scale` op, 需要Lite同学帮忙看下后续的错误:https://github.com/PaddlePaddle/Paddle-Lite/issues/7738#issuecomment-982193932

可能需要替换一下这个文件中的`unsqueeze`使用方式 , 要用paddle.unsqueeze, 而不是`tensor. unsqueeze ` : https://github.com/PaddlePaddle/PaddleNLP/blob/develop/paddlenlp/transformers/transformer/modeling.py @LiuChiachi 或 @FrostML 帮忙确认下? [XShape](https://github.com/PaddlePaddle/Paddle/blob/release/2.1/python/paddle/fluid/layers/nn.py#L6356)并没有被网络用到,所以在save_inference_model的时候会被裁掉,建议这种情况用`unsqueeze`, 而不是`unsqueeze2`. 当然,Paddle-Lite也可以适配下这个case? @chenjiaoAngel