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

2024-05-30 Add FP8 PTQ #1877

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

YZW-explorer
Copy link

@YZW-explorer YZW-explorer commented May 30, 2024

修改Uniform Observer支持FP8量化
image
image

Copy link

paddle-bot bot commented May 30, 2024

Thanks for your contribution!

Copy link
Contributor

@ceci3 ceci3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以增加一下使用文档和使用示例

@@ -21,6 +21,7 @@
- `EMDObserver`:收集最大绝对值并通过最小化EMD误差,收集量化scale
- `HistObserver`:将张量值收集到直方图中,并根据百分比计算量化scale
- `KLObserver`:以最小化浮点值分布与量化浮点值分布之间的 Kullback-Leibler散度计算量化scale
- `AbsmaxObserver`:根据目标权重的Tensor维度,收集最大绝对值作为量化scale,可使用quant_bits调整量化的数据类型,支持FP8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有 absmaxobserver支持fp8吗?

@@ -60,8 +61,8 @@ model = mobilenet_v1()
q_config = QuantConfig(activation=None, weight=None)

# define act_quanter and weight_quanter
act_quanter = MSEObserver()
weight_quanter = MSEObserver()
activation = AbsmaxObserver(quant_bits = (4,3)) # quant_bits = (4,3) and quant_bits = (5,2) for float8_e4m3 and float8_e5m2 formats quantization.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要直接修改已有的示例,新增一个示例表示fp8量化,新增文档说明

@ceci3
Copy link
Contributor

ceci3 commented Jun 25, 2024

可以把不同observer的fp8量化实验结果贴上来

ceci3
ceci3 previously approved these changes Jun 25, 2024
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants