-
Notifications
You must be signed in to change notification settings - Fork 3k
add fp8linear #10488
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
add fp8linear #10488
Conversation
Thanks for your contribution! |
liukebin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
target_x = x | ||
block_size = 1 | ||
|
||
if act_scale is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if act_scale is not None:
if training:
scale = paddle.max(paddle.abs(target_x)) / qmax + quantization_config.epsilon
if state < quantization_config.skip_first_act_scale_step:
act_scale.set_value((state * act_scale + scale) / (state + 1))
else:
act_scale.set_value((1-quantization_config.moving_rate)*act_scale + quantization_config.moving_rate*scale)
scale = act_scale
else:
scale = act_scale
else:
scale = paddle.max(paddle.abs(target_x)) / qmax + quantization_config.epsilon
``` 量化scale统计建议改成这种方式,之前的方式实验的时候发现会训练一段时间后突刺或者loss就不收敛了
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10488 +/- ##
===========================================
- Coverage 48.67% 48.66% -0.01%
===========================================
Files 768 768
Lines 126915 127101 +186
===========================================
+ Hits 61777 61860 +83
- Misses 65138 65241 +103 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR types
New features
PR changes
APIs
Description
qat-fp8linear