Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Bug fixes
PR changes
Others
Description
在 PaddleSlim PTQ量化后导出的模型在进行 Paddle Inference 的 int8 推理的时候会报如下所示的错误:
错误原因:
在运行 trt_delete_weight_dequant_linear_op_pass 时,dequant_linear OP 里面的 weight 是 float32 类型的但是存的是 int8 的值,所以这里直接把 float32 的指针转成 int8 类型会导致这样的错误。
复现步骤:
download 我的这个 repo :https://github.com/Wanglongzhi2001/repo-for-reproduction
运行 custom_infer 文件夹里的 infer.py 进行推理,代码是 paddle-inference-demo 里的示例
量化后的模型提供在这个链接 (pdiparams文件太大了,github 上传不了),是运行 repo 里的 ptq_alexnet.py 文件夹而来,想要复现的话得自行配置好数据集,不想的话就直接用我提供的,代码参考自 PaddleSlim 的示例