forked from open-mmlab/mmrazor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] add quant algo
Learned Step Size Quantization
(open-mmlab…
…#346) * update * Fix a bug in make_divisible. (open-mmlab#333) fix bug in make_divisible Co-authored-by: liukai <liukai@pjlab.org.cn> * [Fix] Fix counter mapping bug (open-mmlab#331) * fix counter mapping bug * move judgment into get_counter_type & update UT * [Docs]Add MMYOLO projects link (open-mmlab#334) * [Doc] fix typos in en/usr_guides (open-mmlab#299) * Update README.md * Update README_zh-CN.md Co-authored-by: Sheffield <49406546+SheffieldCao@users.noreply.github.com> * [Features]Support `MethodInputsRecorder` and `FunctionInputsRecorder` (open-mmlab#320) * support MethodInputsRecorder and FunctionInputsRecorder * fix bugs that the model can not be pickled * WIP: add pytest for ema model * fix bugs in recorder and delivery when ema_hook is used * don't register the DummyDataset * fix pytest * updated * retina loss & predict & tesnor DONE * [Feature] Add deit-base (open-mmlab#332) * WIP: support deit * WIP: add deithead * WIP: fix checkpoint hook * fix data preprocessor * fix cfg * WIP: add readme * reset single_teacher_distill * add metafile * add model to model-index * fix configs and readme * [Feature]Feature map visualization (open-mmlab#293) * WIP: vis * WIP: add visualization * WIP: add visualization hook * WIP: support razor visualizer * WIP * WIP: wrap draw_featmap * support feature map visualization * add a demo image for visualization * fix typos * change eps to 1e-6 * add pytest for visualization * fix vis hook * fix arguments' name * fix img path * support draw inference results * add visualization doc * fix figure url * move files Co-authored-by: weihan cao <HIT-cwh> * [Feature] Add kd examples (open-mmlab#305) * support kd for mbv2 and shufflenetv2 * WIP: fix ckpt path * WIP: fix kd r34-r18 * add metafile * fix metafile * delete * [Doc] add documents about pruning. (open-mmlab#313) * init * update user guide * update images * update * update How to prune your model * update how_to_use_config_tool_of_pruning.md * update doc * move location * update * update * update * add mutablechannels.md * add references Co-authored-by: liukai <liukai@pjlab.org.cn> Co-authored-by: jacky <jacky@xx.com> * [Feature] PyTorch version of `PKD: General Distillation Framework for Object Detectors via Pearson Correlation Coefficient`. (open-mmlab#304) * add pkd * add pytest for pkd * fix cfg * WIP: support fcos3d * WIP: support fcos3d pkd * support mmdet3d * fix cfgs * change eps to 1e-6 and add some comments * fix docstring * fix cfg * add assert * add type hint * WIP: add readme and metafile * fix readme * update metafiles and readme * fix metafile * fix pipeline figure * for RFC * Customed FX initialize * add UT init * [Refactor] Refactor Mutables and Mutators (open-mmlab#324) * refactor mutables * update load fix subnet * add DumpChosen Typehint * adapt UTs * fix lint * Add GroupMixin to ChannelMutator (temporarily) * fix type hints * add GroupMixin doc-string * modified by comments * fix type hits * update subnet format * fix channel group bugs and add UTs * fix doc string * fix comments * refactor diff module forward * fix error in channel mutator doc * fix comments Co-authored-by: liukai <liukai@pjlab.org.cn> * [Fix] Update readme (open-mmlab#341) * update kl readme * update dsnas readme * fix url * Bump version to 1.0.0rc1 (open-mmlab#338) update version * init demo * add customer_tracer * add quantizer * add fake_quant, loop, config * remove CPatcher in custome_tracer * demo_try * init version * modified base.py * pre-rebase * wip of adaround series * adaround experiment * trasfer to s2 * update api * point at sub_reconstruction * pre-checkout * export onnx * add customtracer * fix lint * move custom tracer * fix import * TDO: UTs * Successfully RUN * update loop * update loop docstrings * update quantizer docstrings * update qscheme docstrings * update qobserver docstrings * update tracer docstrings * update UTs init * update UTs init * fix review comments * fix CI * fix UTs * update torch requirements Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com> Co-authored-by: LKJacky <108643365+LKJacky@users.noreply.github.com> Co-authored-by: liukai <liukai@pjlab.org.cn> Co-authored-by: Yang Gao <Gary1546308416AL@gmail.com> Co-authored-by: kitecats <90194592+kitecats@users.noreply.github.com> Co-authored-by: Sheffield <49406546+SheffieldCao@users.noreply.github.com> Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com> Co-authored-by: jacky <jacky@xx.com> Co-authored-by: pppppM <67539920+pppppM@users.noreply.github.com> Co-authored-by: humu789 <humu@pjlab.org.cn>
- Loading branch information
1 parent
67da3ad
commit ffb8247
Showing
54 changed files
with
2,910 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
_base_ = ['mmcls::resnet/resnet18_8xb32_in1k.py'] | ||
|
||
test_cfg = dict( | ||
_delete_=True, | ||
type='mmrazor.PTQLoop', | ||
dataloader=_base_.test_dataloader, | ||
evaluator=_base_.test_evaluator, | ||
calibrate_dataloader=_base_.train_dataloader, | ||
batch_num=32, | ||
# reconstruction_cfg=dict( | ||
# pattern='layer', | ||
# loss=dict( | ||
# type='mmrazor.AdaRoundLoss', | ||
# iters=20000 | ||
# ) | ||
# ) | ||
) | ||
|
||
model = dict( | ||
_delete_=True, | ||
type='mmrazor.GeneralQuant', | ||
architecture=_base_.model, | ||
quantizer=dict( | ||
type='mmrazor.CustomQuantizer', | ||
is_qat=False, | ||
skipped_methods=[ | ||
'mmcls.models.heads.ClsHead._get_loss', | ||
'mmcls.models.heads.ClsHead._get_predictions' | ||
], | ||
qconfig=dict( | ||
qtype='affine', | ||
w_observer=dict(type='mmrazor.MSEObserver'), | ||
a_observer=dict(type='mmrazor.EMAMSEObserver'), | ||
w_fake_quant=dict(type='mmrazor.AdaRoundFakeQuantize'), | ||
a_fake_quant=dict(type='mmrazor.FakeQuantize'), | ||
w_qscheme=dict( | ||
bit=2, | ||
is_symmetry=False, | ||
is_per_channel=True, | ||
is_pot_scale=False, | ||
), | ||
a_qscheme=dict( | ||
bit=4, | ||
is_symmetry=False, | ||
is_per_channel=False, | ||
is_pot_scale=False), | ||
))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_base_ = ['mmcls::resnet/resnet18_8xb32_in1k.py'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_base_ = ['./lsq_resnet50_8xb16_cifar10.py'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
_base_ = ['mmcls::resnet/resnet18_8xb16_cifar10.py'] | ||
|
||
train_cfg = dict( | ||
_delete_=True, | ||
type='mmrazor.QATEpochBasedLoop', | ||
max_epochs=_base_.train_cfg.max_epochs, | ||
) | ||
|
||
model = dict( | ||
_delete_=True, | ||
_scope_='mmrazor', | ||
type='GeneralQuant', | ||
architecture={{_base_.model}}, | ||
quantizer=dict( | ||
type='TensorRTQuantizer', | ||
skipped_methods=[ | ||
'mmcls.models.heads.ClsHead._get_loss', | ||
'mmcls.models.heads.ClsHead._get_predictions' | ||
], | ||
qconfig=dict( | ||
qtype='affine', | ||
w_observer=dict(type='mmrazor.MinMaxObserver'), | ||
a_observer=dict(type='mmrazor.EMAMinMaxObserver'), | ||
w_fake_quant=dict(type='mmrazor.LearnableFakeQuantize'), | ||
a_fake_quant=dict(type='mmrazor.LearnableFakeQuantize'), | ||
w_qscheme=dict( | ||
bit=2, | ||
is_symmetry=False, | ||
is_per_channel=True, | ||
is_pot_scale=False, | ||
), | ||
a_qscheme=dict( | ||
bit=4, | ||
is_symmetry=False, | ||
is_per_channel=False, | ||
is_pot_scale=False), | ||
))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.