-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
add adaround post-quant method #38460
Conversation
Thanks for your contribution! |
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 |
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.
flota->int
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.
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. |
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.
flota->float
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.
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, |
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.
可以复用batch_num么?
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.
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] |
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.
quantized_op_output_name_dict
和weight_op_pairs
都是weight到其它信息的映射,但是命名风格完全不一样。
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.
已统一风格
'beta': beta, | ||
'warm_start': warm_start | ||
} | ||
out = exe.run( |
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.
执行"train_program"的作用是什么?
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.
adaround需要执行训练
648ac0c
to
d256668
Compare
PR types
New features
PR changes
APIs
Describe
Add new adaround post-quant method.