Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何为Paddle新增一个量化标准呢? #63142

Open
Zheng-Bicheng opened this issue Apr 1, 2024 · 3 comments
Open

如何为Paddle新增一个量化标准呢? #63142

Zheng-Bicheng opened this issue Apr 1, 2024 · 3 comments
Assignees
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/following-up 跟进中 type/feature-request 新需求申请

Comments

@Zheng-Bicheng
Copy link
Contributor

需求描述 Feature Description

任务目标

CMSIS-NN是用于ARM Cortex-M系列的芯片的神经网络推理库,用于低性能芯片/架构的神经网络部署。我希望能够使用CMSIS-NN将Paddle模型部署在基于Arm的MCU上

一些可能用到的链接:

目前不能部署的原因

CMSIS-NN遵循TFLite的量化规范,详情请参考TensorFlow Lite 8 位量化规范。我读取了PaddleSlim的模型的量化节点权重信息,发现全部(或者说几乎全部)的模型都是使用的对称量化,这和TFLite的量化范围有所冲突。以Softmax算子为例,在TFLite中,该算子为强制非对称量化,其量化格式如下:

SOFTMAX
  Input 0:
    data_type  : int8
    range      : [-128, 127]
    granularity: per-tensor
  Output 0:
    data_type  : int8
    range      : [-128, 127]
    granularity: per-tensor
    restriction: (scale, zero_point) = (1.0 / 256.0, -128)

希望新增的功能

我希望知道如何为Paddle新增一个量化规范(我可以自行提交一个PR来实现这个需求),涉及到的内容可能有:

  • 我需要知道如何新增一个量化规范(不同的算子应该有不同的量化格式)
  • 我需要知道如何新增一个量化方法(例如为Softmax算子强制固定scale和zp)

替代实现 Alternatives

No response

@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Apr 1, 2024
@jzhang533
Copy link
Contributor

@qingqing01 and the team will be mentoring on this.

@Zheng-Bicheng
Copy link
Contributor Author

@qingqing01 大佬方便简单帮忙看下吗?我可以自己添加,不需要您过多花心思。

@xiaoluomi
Copy link
Contributor

@paddle-bot paddle-bot bot added status/following-up 跟进中 and removed status/new-issue 新建 labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/following-up 跟进中 type/feature-request 新需求申请
Projects
None yet
Development

No branches or pull requests

4 participants