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

add adaround post-quant method #38460

Merged
merged 7 commits into from
Mar 28, 2022

Conversation

yghstill
Copy link
Contributor

@yghstill yghstill commented Dec 26, 2021

PR types

New features

PR changes

APIs

Describe

Add new adaround post-quant method.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jan 3, 2022

Sorry to inform you that 8905820's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

round_type(str, optional): The method of converting the quantized weights
value from float to int. Currently supports ['round', 'adaround'] methods.
Default is `round`, which is rounding nearest to the nearest whole number.
train_iterations(flota, optional): The number of training iter, used to
Copy link
Contributor

Choose a reason for hiding this comment

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

flota->int

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

Default is `round`, which is rounding nearest to the nearest whole number.
train_iterations(flota, optional): The number of training iter, used to
calibrate the adaptive rounding method, when round_type='adaround'.
learning_rate(flota, optional): The learning rate of adaround method.
Copy link
Contributor

Choose a reason for hiding this comment

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

flota->float

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

@@ -143,6 +123,9 @@ def __init__(self,
algo="KL",
hist_percent=0.99999,
quantizable_op_type=["conv2d", "depthwise_conv2d", "mul"],
round_type='round',
train_iterations=1000,
Copy link
Contributor

Choose a reason for hiding this comment

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

可以复用batch_num么?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

for weight_var_name, quant_op_out_name in quantized_op_output_name_dict.items(
):
_logger.info('Start adaround op: {}'.format(weight_var_name))
weight_op_type = weight_op_pairs[weight_var_name]
Copy link
Contributor

Choose a reason for hiding this comment

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

quantized_op_output_name_dict weight_op_pairs都是weight到其它信息的映射,但是命名风格完全不一样。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已统一风格

'beta': beta,
'warm_start': warm_start
}
out = exe.run(
Copy link
Contributor

Choose a reason for hiding this comment

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

执行"train_program"的作用是什么?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adaround需要执行训练

@yghstill yghstill merged commit 3d5a27f into PaddlePaddle:develop Mar 28, 2022
@yghstill yghstill deleted the add_post_quant_adaround branch March 28, 2022 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants