Commit Graph

162 Commits (dd51ab8ca00b41b2dd411af1f29063b8f04799df)
 

Author SHA1 Message Date
PJDong dd51ab8ca0
[Feature] Support unroll with MMDDP in darts algorithm (#210)
* support unroll in darts

* fix bugs in optimizer; add docstring

* update darts algorithm [untested]

* modify autograd.grad to optim_wrapper.backward

* add amp in train.py; support constructor

* rename mmcls.data to mmcls.structures

* modify darts algo to support apex [not done]

* fix code spell in diff_mutable_module

* modify optim_context of dartsddp

* add testcase for dartsddp

* fix bugs of apex in dartsddp

* standardized the unittest of darts

* adapt new data_preprocessor

* fix ut bugs

* remove unness code

Co-authored-by: gaoyang07 <1546308416@qq.com>
2022-10-14 17:41:11 +08:00
whcao 0409adc31f
Update requirements (#319)
update mmengine version
2022-10-13 17:24:15 +08:00
LKJacky b4b7e2432a
merge pruning into dev-1.x (#312)
* add ChannelGroup (#250)

* rebase new dev-1.x

* modification for adding config_template

* add docstring to channel_group.py

* add docstring to mutable_channel_group.py

* rm channel_group_cfg from Graph2ChannelGroups

* change choice type of SequentialChannelGroup from float to int

* add a warning about group-wise conv

* restore __init__ of dynamic op

* in_channel_mutable  ->  mutable_in_channel

* rm abstractproperty

* add a comment about VT

* rm registry for ChannelGroup

* MUTABLECHANNELGROUP -> ChannelGroupType

* refine docstring of IndexDict

* update docstring

* update docstring

* is_prunable -> is_mutable

* update docstring

* fix error in pre-commit

* update unittest

* add return type

* unify init_xxx apit

* add unitest about init of MutableChannelGroup

* update according to reviews

* sequential_channel_group -> sequential_mutable_channel_group

Co-authored-by: liukai <liukai@pjlab.org.cn>

* Add BaseChannelMutator and refactor Autoslim (#289)

* add BaseChannelMutator

* add autoslim

* tmp

* make SequentialMutableChannelGroup accpeted both of num and ratio  as choice. and supports divisior

* update OneShotMutableChannelGroup

* pass supernet training of autoslim

* refine autoslim

* fix bug in OneShotMutableChannelGroup

* refactor make_divisible

* fix spell error:  channl -> channel

* init_using_backward_tracer -> init_from_backward_tracer
init_from_fx_tracer -> init_from_fx_tracer

* refine SequentialMutableChannelGroup

* let mutator support models with dynamicop

* support define search space in model

* tracer_cfg -> parse_cfg

* refine

* using -> from

* update docstring

* update docstring

Co-authored-by: liukai <liukai@pjlab.org.cn>

* refactor slimmable and add l1-norm (#291)

* refactor slimmable and add l1-norm

* make l1-norm support convnd

* update get_channel_groups

* add  l1-norm_resnet34_8xb32_in1k.py

* add pretrained to resnet34-l1

* remove old channel mutator

* BaseChannelMutator -> ChannelMutator

* update according to reviews

* add readme to l1-norm

* MBV2_slimmable -> MBV2_slimmable_config

Co-authored-by: liukai <liukai@pjlab.org.cn>

* Clean old codes. (#296)

* remove old dynamic ops

* move dynamic ops

* clean old mutable_channels

* rm OneShotMutableChannel

* rm MutableChannel

* refine

* refine

* use SquentialMutableChannel to replace OneshotMutableChannel

* refactor dynamicops folder

* let SquentialMutableChannel support float

Co-authored-by: liukai <liukai@pjlab.org.cn>

* Add channel-flow (#301)

* base_channel_mutator -> channel_mutator

* init

* update docstring

* allow omitting redundant configs for channel

* add register_mutable_channel_to_a_module to MutableChannelContainer

* update according to reviews 1

* update according to reviews 2

* update according to reviews 3

* remove old docstring

* fix error

* using->from

* update according to reviews

* support self-define input channel number

* update docstring

* chanenl -> channel_elem

Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: jacky <jacky@xx.com>

* Rename: ChannelGroup -> ChannelUnit (#302)

* refine repr of MutableChannelGroup

* rename folder name

* ChannelGroup -> ChannelUnit

* filename in units folder

* channel_group -> channel_unit

* groups -> units

* group -> unit

* update

* get_mutable_channel_groups -> get_mutable_channel_units

* fix bug

* refine docstring

* fix ci

* fix bug in tracer

Co-authored-by: liukai <liukai@pjlab.org.cn>

* Merge dev-1.x to pruning (#311)

* [feature] CONTRASTIVE REPRESENTATION DISTILLATION with dataset wrapper (#281)

* init

* TD: CRDLoss

* complete UT

* fix docstrings

* fix ci

* update

* fix CI

* DONE

* maintain CRD dataset unique funcs as a mixin

* maintain CRD dataset unique funcs as a mixin

* maintain CRD dataset unique funcs as a mixin

* add UT: CRD_ClsDataset

* init

* TODO: UT test formatting.

* init

* crd dataset wrapper

* update docstring

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>

* [Improvement] Update estimator with api revision (#277)

* update estimator usage and fix bugs

* refactor api of estimator & add inner check methods

* fix docstrings

* update search loop and config

* fix lint

* update unittest

* decouple mmdet dependency and fix lint

Co-authored-by: humu789 <humu@pjlab.org.cn>

* [Fix] Fix tracer (#273)

* test image_classifier_loss_calculator

* fix backward tracer

* update SingleStageDetectorPseudoLoss

* merge

* [Feature] Add Dsnas Algorithm (#226)

* [tmp] Update Dsnas

* [tmp] refactor arch_loss & flops_loss

* Update Dsnas & MMRAZOR_EVALUATOR:
1. finalized compute_loss & handle_grads in algorithm;
2. add MMRAZOR_EVALUATOR;
3. fix bugs.

* Update lr scheduler & fix a bug:
1. update param_scheduler & lr_scheduler for dsnas;
2. fix a bug of switching to finetune stage.

* remove old evaluators

* remove old evaluators

* update param_scheduler config

* merge dev-1.x into gy/estimator

* add flops_loss in Dsnas using ResourcesEstimator

* get resources before mutator.prepare_from_supernet

* delete unness broadcast api from gml

* broadcast spec_modules_resources when estimating

* update early fix mechanism for Dsnas

* fix merge

* update units in estimator

* minor change

* fix data_preprocessor api

* add flops_loss_coef

* remove DsnasOptimWrapper

* fix bn eps and data_preprocessor

* fix bn weight decay bug

* add betas for mutator optimizer

* set diff_rank_seed=True for dsnas

* fix start_factor of lr when warm up

* remove .module in non-ddp mode

* add GlobalAveragePoolingWithDropout

* add UT for dsnas

* remove unness channel adjustment for shufflenetv2

* update supernet configs

* delete unness dropout

* delete unness part with minor change on dsnas

* minor change on the flag of search stage

* update README and subnet configs

* add UT for OneHotMutableOP

* [Feature] Update train (#279)

* support auto resume

* add enable auto_scale_lr in train.py

* support '--amp' option

* [Fix] Fix darts metafile (#278)

fix darts metafile

* fix ci (#284)

* fix ci for circle ci

* fix bug in test_metafiles

* add  pr_stage_test for github ci

* add multiple version

* fix ut

* fix lint

* Temporarily skip dataset UT

* update github ci

* add github lint ci

* install wheel

* remove timm from requirements

* install wheel when test on windows

* fix error

* fix bug

* remove github windows ci

* fix device error of arch_params when DsnasDDP

* fix CRD dataset ut

* fix scope error

* rm test_cuda in workflows of github

* [Doc] fix typos in en/usr_guides

Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: pppppM <gjf_mail@126.com>
Co-authored-by: gaoyang07 <1546308416@qq.com>
Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>

Co-authored-by: P.Huang <37200926+FreakieHuang@users.noreply.github.com>
Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
Co-authored-by: Yang Gao <Gary1546308416AL@gmail.com>
Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: pppppM <gjf_mail@126.com>
Co-authored-by: gaoyang07 <1546308416@qq.com>
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>

* Refine pruning branch (#307)

* [feature] CONTRASTIVE REPRESENTATION DISTILLATION with dataset wrapper (#281)

* init

* TD: CRDLoss

* complete UT

* fix docstrings

* fix ci

* update

* fix CI

* DONE

* maintain CRD dataset unique funcs as a mixin

* maintain CRD dataset unique funcs as a mixin

* maintain CRD dataset unique funcs as a mixin

* add UT: CRD_ClsDataset

* init

* TODO: UT test formatting.

* init

* crd dataset wrapper

* update docstring

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>

* [Improvement] Update estimator with api revision (#277)

* update estimator usage and fix bugs

* refactor api of estimator & add inner check methods

* fix docstrings

* update search loop and config

* fix lint

* update unittest

* decouple mmdet dependency and fix lint

Co-authored-by: humu789 <humu@pjlab.org.cn>

* [Fix] Fix tracer (#273)

* test image_classifier_loss_calculator

* fix backward tracer

* update SingleStageDetectorPseudoLoss

* merge

* [Feature] Add Dsnas Algorithm (#226)

* [tmp] Update Dsnas

* [tmp] refactor arch_loss & flops_loss

* Update Dsnas & MMRAZOR_EVALUATOR:
1. finalized compute_loss & handle_grads in algorithm;
2. add MMRAZOR_EVALUATOR;
3. fix bugs.

* Update lr scheduler & fix a bug:
1. update param_scheduler & lr_scheduler for dsnas;
2. fix a bug of switching to finetune stage.

* remove old evaluators

* remove old evaluators

* update param_scheduler config

* merge dev-1.x into gy/estimator

* add flops_loss in Dsnas using ResourcesEstimator

* get resources before mutator.prepare_from_supernet

* delete unness broadcast api from gml

* broadcast spec_modules_resources when estimating

* update early fix mechanism for Dsnas

* fix merge

* update units in estimator

* minor change

* fix data_preprocessor api

* add flops_loss_coef

* remove DsnasOptimWrapper

* fix bn eps and data_preprocessor

* fix bn weight decay bug

* add betas for mutator optimizer

* set diff_rank_seed=True for dsnas

* fix start_factor of lr when warm up

* remove .module in non-ddp mode

* add GlobalAveragePoolingWithDropout

* add UT for dsnas

* remove unness channel adjustment for shufflenetv2

* update supernet configs

* delete unness dropout

* delete unness part with minor change on dsnas

* minor change on the flag of search stage

* update README and subnet configs

* add UT for OneHotMutableOP

* [Feature] Update train (#279)

* support auto resume

* add enable auto_scale_lr in train.py

* support '--amp' option

* [Fix] Fix darts metafile (#278)

fix darts metafile

* fix ci (#284)

* fix ci for circle ci

* fix bug in test_metafiles

* add  pr_stage_test for github ci

* add multiple version

* fix ut

* fix lint

* Temporarily skip dataset UT

* update github ci

* add github lint ci

* install wheel

* remove timm from requirements

* install wheel when test on windows

* fix error

* fix bug

* remove github windows ci

* fix device error of arch_params when DsnasDDP

* fix CRD dataset ut

* fix scope error

* rm test_cuda in workflows of github

* [Doc] fix typos in en/usr_guides

Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: pppppM <gjf_mail@126.com>
Co-authored-by: gaoyang07 <1546308416@qq.com>
Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>

* fix bug when python=3.6

* fix lint

* fix bug when test using cpu only

* refine ci

* fix error in ci

* try ci

* update repr of Channel

* fix error

* mv init_from_predefined_model to MutableChannelUnit

* move tests

* update SquentialMutableChannel

* update l1 mutable channel unit

* add OneShotMutableChannel

* candidate_mode -> choice_mode

* update docstring

* change ci

Co-authored-by: P.Huang <37200926+FreakieHuang@users.noreply.github.com>
Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
Co-authored-by: Yang Gao <Gary1546308416AL@gmail.com>
Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: pppppM <gjf_mail@126.com>
Co-authored-by: gaoyang07 <1546308416@qq.com>
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>

Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: jacky <jacky@xx.com>
Co-authored-by: P.Huang <37200926+FreakieHuang@users.noreply.github.com>
Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
Co-authored-by: Yang Gao <Gary1546308416AL@gmail.com>
Co-authored-by: humu789 <humu@pjlab.org.cn>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: pppppM <gjf_mail@126.com>
Co-authored-by: gaoyang07 <1546308416@qq.com>
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>
2022-10-10 17:30:25 +08:00
LKJacky f98ac3416b
fix ci (#284)
* fix ci for circle ci

* fix bug in test_metafiles

* add  pr_stage_test for github ci

* add multiple version

* fix ut

* fix lint

* Temporarily skip dataset UT

* update github ci

* add github lint ci

* install wheel

* remove timm from requirements

* install wheel when test on windows

* fix error

* fix bug

* remove github windows ci

* fix device error of arch_params when DsnasDDP

* fix CRD dataset ut

* fix scope error

* rm test_cuda in workflows of github

* [Doc] fix typos in en/usr_guides

Co-authored-by: liukai <liukai@pjlab.org.cn>
Co-authored-by: pppppM <gjf_mail@126.com>
Co-authored-by: gaoyang07 <1546308416@qq.com>
Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>
2022-10-10 10:06:57 +08:00
Yang Gao 6cd8c68d0f
[Fix] Fix darts metafile (#278)
fix darts metafile
2022-10-08 10:35:48 +08:00
whcao ef39c51bb9
[Feature] Update train (#279)
* support auto resume

* add enable auto_scale_lr in train.py

* support '--amp' option
2022-10-08 10:31:04 +08:00
Yang Gao 8d603d917e
[Feature] Add Dsnas Algorithm (#226)
* [tmp] Update Dsnas

* [tmp] refactor arch_loss & flops_loss

* Update Dsnas & MMRAZOR_EVALUATOR:
1. finalized compute_loss & handle_grads in algorithm;
2. add MMRAZOR_EVALUATOR;
3. fix bugs.

* Update lr scheduler & fix a bug:
1. update param_scheduler & lr_scheduler for dsnas;
2. fix a bug of switching to finetune stage.

* remove old evaluators

* remove old evaluators

* update param_scheduler config

* merge dev-1.x into gy/estimator

* add flops_loss in Dsnas using ResourcesEstimator

* get resources before mutator.prepare_from_supernet

* delete unness broadcast api from gml

* broadcast spec_modules_resources when estimating

* update early fix mechanism for Dsnas

* fix merge

* update units in estimator

* minor change

* fix data_preprocessor api

* add flops_loss_coef

* remove DsnasOptimWrapper

* fix bn eps and data_preprocessor

* fix bn weight decay bug

* add betas for mutator optimizer

* set diff_rank_seed=True for dsnas

* fix start_factor of lr when warm up

* remove .module in non-ddp mode

* add GlobalAveragePoolingWithDropout

* add UT for dsnas

* remove unness channel adjustment for shufflenetv2

* update supernet configs

* delete unness dropout

* delete unness part with minor change on dsnas

* minor change on the flag of search stage

* update README and subnet configs

* add UT for OneHotMutableOP
2022-09-29 16:48:47 +08:00
whcao d07dee9887
[Fix] Fix tracer (#273)
* test image_classifier_loss_calculator

* fix backward tracer

* update SingleStageDetectorPseudoLoss

* merge
2022-09-15 14:52:54 +08:00
Yang Gao 4e80037393
[Improvement] Update estimator with api revision (#277)
* update estimator usage and fix bugs

* refactor api of estimator & add inner check methods

* fix docstrings

* update search loop and config

* fix lint

* update unittest

* decouple mmdet dependency and fix lint

Co-authored-by: humu789 <humu@pjlab.org.cn>
2022-09-14 20:39:49 +08:00
P.Huang eb25bb7577
[feature] CONTRASTIVE REPRESENTATION DISTILLATION with dataset wrapper (#281)
* init

* TD: CRDLoss

* complete UT

* fix docstrings

* fix ci

* update

* fix CI

* DONE

* maintain CRD dataset unique funcs as a mixin

* maintain CRD dataset unique funcs as a mixin

* maintain CRD dataset unique funcs as a mixin

* add UT: CRD_ClsDataset

* init

* TODO: UT test formatting.

* init

* crd dataset wrapper

* update docstring

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
2022-09-13 20:53:43 +08:00
Yang Gao 1f1bcd181c
[Doc] Complete doc strings of estimators (#275)
* complete doc strings of estimators

* add Optional for params with default value
2022-09-01 15:17:28 +08:00
gaojianfei ece95a69ae update razor version 2022-09-01 13:03:38 +08:00
gaojianfei edbab234c0 Update MMCV version 2022-09-01 12:21:12 +08:00
pppppM 6d3bb47495
Bump version to 1.0.0rc0 (#268)
* add changelog

* update changelog

Co-authored-by: gaojianfei <gaojianfei@sensetime.com>
2022-09-01 12:11:07 +08:00
pppppM 41464c6af3
Regression Benchmark (#271)
* update benchmark test

* fix circle ci gpu config

* move delivery, recorder, tracer from structures to task modules

* move ops from models to models.architectures

* rename dynamic_op to dynamic_ops

* fix configs and metafiles

* remove some github ci

* fix configs / readme / metafile

Co-authored-by: gaojianfei <gaojianfei@sensetime.com>
2022-09-01 11:54:18 +08:00
P.Huang 5e072c4031
[Improvement] Update OFD & FT metafiles (#267)
* update OFD & FT metafiles

* update wrn16 metadata

* update all metafiles

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
2022-09-01 09:36:28 +08:00
humu789 93bf46881b
[Doc] Update README.md and fix docs (#270)
* fix docs

* update README.md and model_zoo

* fix lint

* update README.md

* fix lint
2022-09-01 01:15:18 +08:00
humu789 57bf6fa30e
Update search configs (#269)
* update score_key

* search_debug

* add search config & fix _check_constraints

* fix ut
2022-09-01 00:13:01 +08:00
zengyi f9ac06f36c
[Docs] Add metafiles for KD algo (BYOT, DKD) (#264)
* fix config

* add metafile
add model & log link

* fix inference time

* fix recorder.py typo

* fix advanced_guides linting

* fix docs tailing space & eof

* fix readme style

* fix auto merge

Co-authored-by: zengyi.vendor <zengyi.vendor@sensetime.com>
2022-08-31 22:16:07 +08:00
zhongyu zhang f69aeabc69
[Docs] Add metafiles for KD algos (ABLoss, DAFL, DFAD, FBKD, FitNets, ZSKT) (#266)
1.Add metafiles for 6 kd algos.
2.Add model and log links. 
3.Revise data_samples in datafreedistillation for new feature of mmengine.
2022-08-31 22:12:25 +08:00
PJDong 24e106ba1d
[Doc] Optimize docs and Fix lint (#261)
* fix name of mmcv-full to mmcv

* [doc] move the location of nas/kd/pruning; fix lint errors

* optimize docs and fix pre-commit error

* [Doc&Fix] add note for installation; fix the requirements

* update docs

Co-authored-by: humu789 <humu@pjlab.org.cn>
2022-08-31 18:33:47 +08:00
pppppM 5105489d64
Revert "[Enhancement] Add benchmark test script" (#263)
Revert "[Enhancement] Add benchmark test script (#262)"

This reverts commit f60cf9c469.
2022-08-30 22:03:54 +08:00
pppppM f60cf9c469
[Enhancement] Add benchmark test script (#262)
* update benchmark test

* fix circle ci gpu config

* fix lints

Co-authored-by: gaojianfei <gaojianfei@sensetime.com>
2022-08-30 21:59:39 +08:00
pppppM 8a249fd98d
[CI] Add circle ci (#257)
* copy .circleci from mmdet

* adapt mmrazor

* change the min docstring coverage

* fix typos

* update publish model script

* update circle ci config
2022-08-30 20:20:10 +08:00
PJDong c650b3eee5
[Doc] Add Tutorial of KD,Pruning,NAS and Installation. (#255)
* [doc] add doc of installation, kd, nas, pruning

* [doc] add user guide part

* fix name of mmcv-full to mmcv

* [doc] fix mmcv based on zaida 's suggestion

* [doc] fix index error based on shiguang's comments
2022-08-30 19:48:18 +08:00
humu789 ce22497b25
[Docs] Add docs and update algo README (#259)
* docs v0.1

* update picture links in algo README
2022-08-30 19:46:37 +08:00
P.Huang f45e2bdca3
[Improvement] Decouple dependency (#254)
* add dependency placeholder

* update requirements

* decouple mmcls dependencies

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
2022-08-30 09:57:23 +08:00
pppppM e3390ce8ae
[Bugs] Fix some bugs found during testing and add dev scripts (#256)
* update training benchmark

* fix detnas config

* fix pspnet config

* fix cwd configs

* fix cwd metafile

Co-authored-by: gaojianfei <gaojianfei@sensetime.com>
2022-08-29 22:45:46 +08:00
pppppM 179bd5287d
[Fix] Adapt latest mmcv (#253)
* Adapt to the latest mmcv and mmengine

* fixed ut_subnet_sampler_loop

* fix get_model

* fix lints

Co-authored-by: humu789 <humu@pjlab.org.cn>
2022-08-29 20:34:51 +08:00
humu789 b2272eb313
[Docs] Refactor readthedocs (#252)
refactor readthedocs
2022-08-29 18:41:51 +08:00
P.Huang 5d9fcd8070
[feature] add `A Comprehensive Overhaul of Feature Distillation` (#244)
* init

* init

* linting

* add README

* add wrn docstrings

* add vanilla wrn configs

* fix UT

* OFD DONE

* update OFD readme

* update config path

* rename vanilla model files

* rename vanilla models config files

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
2022-08-29 14:06:58 +08:00
zhongyu zhang 1c0da58dae
[Feature] Add FBKD algorithm and torch_connectors (#248)
* 1.Add FBKD

* 1.Add torch_connector and its ut. 2.Revise readme and fbkd config.

* 1.Revise UT for torch_connectors

* 1.Revise nonlocalblock into a subclass of NonLocal2d in mmcv.cnn
2022-08-29 10:05:32 +08:00
zhongyu zhang f3b964c521
[Feature] Add DFAD algorithm (#247)
1.Add DFAD algorithm. 2.Add L1Loss and its UT.
2022-08-25 15:46:45 +08:00
LKJacky c749bd751a
[fix]fix config error of autoslim (#246)
fix config error of autoslim

Co-authored-by: liukai <liukai@pjlab.org.cn>
2022-08-24 18:58:30 +08:00
zhongyu zhang 876b2ac033
[Feature] Add Zero-shot Knowledge Transfer via Adversarial Belief Matching (#241)
* 1.Add ZSKT algorithm with zskt_generator, at_loss. 2.Add teacher_detach in kl_divergence.

* 1.Amend readme. 2.Revise UT bugs of test_graph and test_distill.

* 1.Amend docstring of zskt_generator

* 1.Add torch version judgment in test_distillation_loss.

* 1.Revise defaults of batch_size to 1 in generators. 2.Revise mmcls.data to mmcls.structures

* 1.Rename function "at" to "calc_attention_matrix".
2022-08-24 14:57:35 +08:00
wang shiguang ba71abf357
[fix] fix mmcv mmengine (#242)
* align_with_mmcv_and_mmengine

* fix_mmcv.fileio
2022-08-24 09:58:11 +08:00
P.Huang afb95a40e7
[feature] add Factor Transfer (#237)
* init

* init

* update

* done

* update README

* update README

* update README

* update README

* update README

* fix docstring && fix typing

* update

Co-authored-by: huangpengsheng <huangpengsheng@sensetime.com>
2022-08-23 19:52:35 +08:00
Yang Gao 4b3f8ab69e
[Feature] Refactor Estimator for computing FLOPs/Params/Latency. (#230)
* Refactor ModelEstimator:
1. add EvaluatorLoop in engine.runners;
2. add estimator for structures (both subnet & supernet);
3. add layer_counter for each op.

* fix lint

* update estimator:
1. add ResourceEstimator based on BaseEstimator;
2. add notes & examples for ResourceEstimator & EvaluatorLoop usage;
3. fix a bug of latency test.
4. minor changes according to comments.

* add UT & fix a bug caused by UT

* add docstrings & remove old estimator

* update docstrings for op_spec_counters

* rename resource_evaluator_val_loop

* support adding resource attrs of each submodule in a measured model

* fix lint

* refactor estimator file structures

* support estimating resources for spec modules

* rm old UT

* update new estimator UT cases

* fix traversal range of the model

* cancel unit convert in accumulate_sub_module_flops_params

* use estimator_cfg to build ResourceEstimator

* fix a broadcast bug

* delete fixed input_shape

* add assertion and string-format-return when measuring spec_modules

* add UT for estimating spec_modules
2022-08-23 15:01:47 +08:00
zhongyu zhang 57aec1f730
[Feature] Add DAFL Distillation (#235)
* 1.Add DAFL, including config, DAFLLoss and readme. 2.Add DataFreeDistillationtillation. 3.Add Generator, including base_generator and dafl_generator. 4.Add get_module_device and set_requires_grad functions in utils.

* 1.Amend the file that report error in mypy test under py37, including gather_tensors, datafree_distillation, base_generator. 2.Revise other linting error.

* 1.Revise some docstrings.

* 1.Add UT for datafreedistillation. 2.Add all typing.hints.

* 1.Add UT for generators and gather_tensors.

* 1.Add assert of batch_size in base_generator

* 1.Isort

Co-authored-by: zhangzhongyu.vendor < zhangzhongyu.vendor@sensetime.com>
2022-08-23 10:47:34 +08:00
zengyi 72c11751cb
fix readme.md table 2022-08-22 14:26:32 +08:00
zengyi c6e8dcd209
[Feature] Add BYOT Distillation (#232)
* byot connector & distiller

* fix config

* fix connector

* tmpsave

* add byot & kdsoftce loss

* update dev-1.x

* fx wsld

* Update README.md

* Update README.md

* fix md

* add ut & REQUIRE REVIEW part

* fix md

* add SelfDistillValLoop UT

* fix comments

* fix comments v2

* fix comments v3

* add connector_idx=None to ConfigurableDistiller.get_record()

Co-authored-by: zengyi.vendor <zengyi.vendor@sensetime.com>
2022-08-22 14:08:02 +08:00
LKJacky 83240dcd8a
add BaseNode/BaseGraph, ModuleNode/ModuleGraph (#217)
* add BaseNode/BaseGraph,  ModuleNode/ModuleGraph

* add docstring, redesign some functions

* add 'placeholder' after cat/bind/pass

* change type to a property from a method

* add test model s

* rename XXXNode in path to PathXXXNode

* 'xxconv' -> 'xxconv2d' in type

* ToGraph -> GraphConverter, PathToGraph -> PathToGraphConverter

* rm init_from_path_list

* convert some public methods to private methods in GraphConverter

* type -> basic_type

* fix some error

Co-authored-by: liukai <liukai@pjlab.org.cn>
2022-08-19 15:38:19 +08:00
qiufeng d190037a5e
[Feature] Add dynamic bricks (#228)
* add dynamic bricks

* add dynamic conv2d test

* add tests for dynamic linear and dynamic norm

* add docstring for dynamic conv2d

* add docstring for dynamic linear

* add docstring for dynamic batchnorm

* Refactor the dynamic op ( put more logic into the mixin )

* fix UT

* Fix UT ( fileio was moved to mmengine)

* derived mutable adds choices property

* Unify the register interface of mutable in dynamic op

* Unified getter interface of mutable in dynamic op

Co-authored-by: gaojianfei <gaojianfei@sensetime.com>
Co-authored-by: pppppM <gjf_mail@126.com>
2022-08-19 15:15:38 +08:00
whcao 8775b033b0
[Bug]Fix iterable import bug (#233)
fix iterable import bug
2022-08-18 13:41:07 +08:00
zhongyu zhang a5435d74b9
[Fix] Fix AssertionError in test_connector (#231)
fix connector UT bug
2022-08-15 14:59:58 +08:00
spynccat a1937fd5a6
[Feature] Add Decoupled KD Loss (#222)
* add DKDLoss, config

* linting

* linting

* reset default reduction

* dkd ut

* Update decoupled_kd.py

* Update decoupled_kd.py

* Update decoupled_kd.py

* fix commit

* fix readme

* fix comments

* linting comment

* rename loss params

* fix docstring

* Update decoupled_kd.py

* fix gt from config

* merge fix

* fix ut & wsld

* Update README.md

* Update README.md

* add Acknowledgement

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* fix readme style

* fix md

Co-authored-by: zengyi.vendor <zengyi.vendor@sensetime.com>
2022-08-15 14:59:24 +08:00
qiufeng 6e8ebfd85a
[Fix] Fix `Protocol` import error when python<3.8 (#227)
fix Protocol import error
2022-08-12 13:06:12 +08:00
qiufeng 7dca9ba7c7
[Feature] Add `DerivedMutable` & `MutableValue` (#215)
* fix lint

* complement unittest for derived mutable

* add docstring for derived mutable

* add unittest for mutable value

* fix logger error

* fix according to comments

* not dump derived mutable when export

* add warning in `export_fix_subnet`

* fix __mul__ in mutable value
2022-08-10 16:07:03 +08:00
PJDong 696191e0c0
[Refactor] Move `build_arch_param` from `DiffMutableModule` to `DiffModuleMutator` (#221)
* move build_arch_param from mutable to mutator

* fix UT of diff mutable and mutator

* modify based on shiguang's comments

* remove mutator from the unittest of mutable
2022-08-10 10:05:32 +08:00
humu789 e4305f3d0b
[Bug] Fix darts loop unittest (#218)
* fix_darts_loop

* fix darts_loop unittest
2022-08-05 17:46:05 +08:00