forked from open-mmlab/mmpretrain
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vit-small-p16_8xb128-linear-coslr-90e_in1k.py
45 lines (39 loc) · 1.2 KB
/
vit-small-p16_8xb128-linear-coslr-90e_in1k.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
45
_base_ = [
'../../_base_/datasets/imagenet_bs32_pil_resize.py',
'../../_base_/default_runtime.py',
]
# dataset settings
train_dataloader = dict(batch_size=128)
# model settings
model = dict(
type='ImageClassifier',
backbone=dict(
type='MoCoV3ViT',
arch='mocov3-small', # embed_dim = 384
img_size=224,
patch_size=16,
stop_grad_conv1=True,
frozen_stages=12,
norm_eval=True,
init_cfg=dict(type='Pretrained', checkpoint='', prefix='backbone.')),
head=dict(
type='VisionTransformerClsHead',
num_classes=1000,
in_channels=384,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
init_cfg=dict(type='Normal', std=0.01, layer='Linear'),
))
# optimizer
optim_wrapper = dict(
type='OptimWrapper',
optimizer=dict(type='SGD', lr=12, momentum=0.9, weight_decay=0.))
# learning rate scheduler
param_scheduler = [
dict(type='CosineAnnealingLR', T_max=90, by_epoch=True, begin=0, end=90)
]
# runtime settings
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=90)
val_cfg = dict()
test_cfg = dict()
default_hooks = dict(
checkpoint=dict(type='CheckpointHook', interval=10, max_keep_ckpts=3))