-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add resnet50 * fix bug * fix bug * fix bug * refine * fix bug * add choice and mask of units to checkpoint (#397) * add choice and mask of units to checkpoint * update * fix bug * remove device operation * fix bug * fix circle ci error * fix error in numpy for circle ci * fix bug in requirements * restore * add a note * a new solution * save mutable_channel.mask as float for dist training * refine * mv meta file test Co-authored-by: liukai <your_email@abc.example> Co-authored-by: jacky <jacky@xx.com> * fix bug * add assert * fix bug * change iter to epoch * bn_imp use abs Co-authored-by: jacky <jacky@xx.com> Co-authored-by: liukai <your_email@abc.example>
- Loading branch information
1 parent
a91e2c7
commit 122ee38
Showing
13 changed files
with
183 additions
and
59 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,29 @@ | ||
_base_ = ['mmcls::resnet/resnet50_8xb32_in1k.py'] | ||
|
||
data_preprocessor = {'type': 'mmcls.ClsDataPreprocessor'} | ||
architecture = _base_.model | ||
architecture.update({ | ||
'init_cfg': { | ||
'type': | ||
'Pretrained', | ||
'checkpoint': | ||
'https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth' # noqa | ||
} | ||
}) | ||
|
||
model = dict( | ||
_delete_=True, | ||
_scope_='mmrazor', | ||
type='ChexAlgorithm', | ||
architecture=architecture, | ||
mutator_cfg=dict( | ||
type='ChexMutator', | ||
channel_unit_cfg=dict( | ||
type='ChexUnit', default_args=dict(choice_mode='number', )), | ||
channel_ratio=0.7, | ||
), | ||
delta_t=2, | ||
total_steps=60, | ||
init_growth_rate=0.3, | ||
) | ||
custom_hooks = [{'type': 'mmrazor.ChexHook'}] |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from .chex_algorithm import ChexAlgorithm | ||
from .chex_hook import ChexHook | ||
from .chex_mutator import ChexMutator | ||
from .chex_ops import ChexConv2d, ChexLinear, ChexMixin | ||
from .chex_unit import ChexUnit | ||
|
||
__all__ = [ | ||
'ChexAlgorithm', 'ChexMutator', 'ChexUnit', 'ChexConv2d', 'ChexLinear', | ||
'ChexMixin' | ||
'ChexMixin', 'ChexHook' | ||
] |
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,24 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from mmengine.hooks import Hook | ||
|
||
from mmrazor.registry import HOOKS | ||
|
||
|
||
@HOOKS.register_module() | ||
class ChexHook(Hook): | ||
pass | ||
# @classmethod | ||
# def algorithm(cls, runner): | ||
# if dist.is_distributed(): | ||
# return runner.model.module | ||
# else: | ||
# return runner.model | ||
|
||
# def before_val(self, runner) -> None: | ||
# algorithm = self.algorithm(runner) | ||
# if dist.get_rank() == 0: | ||
# config = {} | ||
# for unit in algorithm.mutator.mutable_units: | ||
# config[unit.name] = unit.current_choice | ||
# print_log(json.dumps(config, indent=4)) | ||
# print_log(f'growth_ratio: {algorithm.growth_ratio}') |
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
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.