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 regularizer #73

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

lz02k
Copy link
Collaborator

@lz02k lz02k commented Nov 17, 2022

@lz02k lz02k assigned Jiang-Stan and unassigned Jiang-Stan Nov 17, 2022
@lz02k lz02k changed the title Lz02k/add regularizer add regularizer Nov 25, 2022
@@ -34,6 +35,7 @@ def __init__(self, model: nn.Module, config):
self._run_simplifiers()
self._convert2quantmodule()
self._build_quantizer()
self._build_regularizer()
Copy link
Member

Choose a reason for hiding this comment

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

不建议成为quant_model的一部分, 而是由用户直接在main函数中调用

REGULARIZER:
ENABLE: True
TYPE: dampen
LAMBDA: 0.01
Copy link
Member

Choose a reason for hiding this comment

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

不建议lambda作为quant_config一部分, 而是应该成为main.py parser的一部分

self.config = config

def _get_loss(self, x, quantizer):

Copy link
Member

Choose a reason for hiding this comment

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

please use black to reformat

scale = scale.detach()
zero_point = zero_point.detach()

min_val = (qmin - zero_point) * scale
Copy link
Member

@PeiqinSun PeiqinSun Dec 9, 2022

Choose a reason for hiding this comment

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

@lz02k
Copy link
Collaborator Author

lz02k commented Jan 5, 2023

model Regularizer Aggregation lambda top1 remark
MobileNetV2 - - - 69.11 baseline
MobileNetV2 Dampen sum 0.001 69.45
MobileNetV2 Dampen mean 1.0 69.34

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.

None yet

3 participants