-
Notifications
You must be signed in to change notification settings - Fork 231
/
Copy pathdarts_subnet_1xb96_cifar10_2.0.py
44 lines (40 loc) · 1.46 KB
/
darts_subnet_1xb96_cifar10_2.0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
_base_ = [
'mmrazor::_base_/settings/cifar10_darts_subnet.py',
'mmrazor::_base_/nas_backbones/darts_supernet.py',
'mmcls::_base_/default_runtime.py',
]
subnet_backbone = _base_.nas_backbone
subnet_backbone.base_channels = 36
subnet_backbone.num_layers = 20
subnet_backbone.auxliary = True
subnet_backbone.aux_channels = 128
subnet_backbone.aux_out_channels = 768
subnet_backbone.out_indices = (19, )
subnet_backbone.norm_cfg = norm_cfg = dict(type='BN', affine=True)
# model
supernet = dict(
type='ImageClassifier',
data_preprocessor=_base_.preprocess_cfg,
backbone=subnet_backbone,
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='mmrazor.DartsSubnetClsHead',
num_classes=10,
in_channels=576,
aux_in_channels=768,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
aux_loss=dict(type='CrossEntropyLoss', loss_weight=0.4),
topk=(1, 5),
cal_acc=True))
model = dict(
type='mmrazor.sub_model',
cfg=supernet,
# NOTE: You can replace the yaml with the mutable_cfg searched by yourself
fix_subnet='configs/nas/mmcls/darts/DARTS_SUBNET_CIFAR_PAPER_ALIAS.yaml',
init_cfg=dict(
type='Pretrained',
checkpoint= # noqa: E251
'https://download.openmmlab.com/mmrazor/v1/darts/darts_subnetnet_1xb96_cifar10_acc-97.27_20211222-17e42600_latest.pth', # noqa: E501
prefix='architecture.'))
model_wrapper_cfg = None
find_unused_parameters = True