Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • Paddle
  • 合并请求
  • !27518

P
Paddle
  • 项目概览

PaddlePaddle / Paddle
大约 2 年 前同步成功

通知 2325
Star 20933
Fork 5424
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 1423
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 543
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
P
Paddle
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 1,423
    • Issue 1,423
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 543
    • 合并请求 543
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板

Added support for quantization of fusion_gru !27518

  • Report abuse
!27518 开放中 9月 23, 2020 由 saxon_zh@saxon_zh 创建
#<User:0x00007f7e11f13128>
  • 概览 0
  • 提交 6
  • 变更 20

Created by: wojtuss

PR types

New features

PR changes

OPs

Describe

This patch adds support for INT8 quantization of fusion_gru op. It includes commits from PR https://github.com/PaddlePaddle/Paddle/pull/27481 and provides the rest of functionality required for https://github.com/PaddlePaddle/Paddle/issues/27330.

This patch adds also a test with transformation of a quant GRU model into int8 model. The saved int8 model can be used for testing accuracy and performance:

ctest -R save_quant2_model_gru -V

Performance benchmarking will make sense only after bumping up oneDNN version commit with an optimized GRU INT8 primitive, as the current oneDNN version provides unoptimized GRU INT8 kernel only. The oneDNN version will be updated most probably by the end of this week.

With these changes INT8 quantization of the fusion_gru op will be enabled. However, quantization of all the quantizable operators in the GRU model does not work yet because other operators like concat does not support quantization with shift yet. For performance reasons it is desirable to have a sequence of quantized operators without dequantization/quantization in between, so support for quantization of concat op with shift will be implemented as well. A PR with the changes should come by the end of this week as well.

[Update] Now the patch has updated oneDNN commit hash containing optimized version of GRU INT8 kernel. Here are the benchmark results of the saved GRU INT8 model on CLX 6248:   | fp32 | qat (fp32) | int8 | int8-qat diff | fp32/int8 ratio -- | -- | -- | -- | -- | -- Precision | 0.89211 | 0.89198 | 0.89221 | 0.00023 |   Recall | 0.89442 | 0.89449 | 0.89412 | -0.00037 |   F1 score | 0.89326 | 0.89323 | 0.89316 | -0.00007 |   batch latency (ms) | 25.3818 | 27.8914 | 15.9434 |   | 1.59

The command for GRU INT8 model benchmarking:

build/paddle/fluid/inference/tests/api/test_analyzer_lexical_analysis \
          --infer_model=build/third_party/inference_demo/quant/GRU_quant2_int8 \
          --infer_data=build/third_party/inference_demo/gru/GRU_eval_data.bin \
          --batch_size=50 \
          --cpu_num_threads=1 \
          --with_accuracy_layer=true \
          --use_analysis=false \
          --iterations=0

For GRU FP32 use the model from http://paddle-inference-dist.bj.bcebos.com/gru/GRU_eval_model_v2.tar.gz

There are still options to improve INT8 performance, we are working on them.

指派人
分配到
审核者
Request review from
无
里程碑
无
分配里程碑
工时统计
标识: paddlepaddle/Paddle!27518
Source branch: github/fork/wojtuss/wojtuss/fusion_gru_quantization
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7