Skip to content

Commit bce3a2e

Browse files
committed
ya models
1 parent 9da2a92 commit bce3a2e

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/model_constructor/yaresnet.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22
# Yet another ResNet.
33

44
from collections import OrderedDict
5-
from functools import partial
65
from typing import Union
76

87
import torch.nn as nn
98
from torch.nn import Mish
109

1110
from .layers import ConvBnAct
12-
from .net import Net
11+
from .model_constructor import CfgMC, ModelConstructor
1312

1413
__all__ = [
1514
'YaResBlock',
16-
# 'yaresnet_parameters',
17-
# 'yaresnet34',
18-
# 'yaresnet50',
15+
'yaresnet34',
16+
'yaresnet50',
1917
]
2018

2119

@@ -128,6 +126,21 @@ def forward(self, x):
128126
return self.merge(self.convs(x) + identity)
129127

130128

131-
# yaresnet_parameters = {'block': YaResBlock, 'stem_sizes': [3, 32, 64, 64], 'act_fn': Mish(), 'stem_stride_on': 1}
132-
# yaresnet34 = partial(Net, name='YaResnet34', expansion=1, layers=[3, 4, 6, 3], **yaresnet_parameters)
133-
# yaresnet50 = partial(Net, name='YaResnet50', expansion=4, layers=[3, 4, 6, 3], **yaresnet_parameters)
129+
yaresnet34 = ModelConstructor.from_cfg(
130+
CfgMC(
131+
name='YaResnet34',
132+
block=YaResBlock,
133+
expansion=1,
134+
layers=[3, 4, 6, 3],
135+
act_fn=Mish(),
136+
)
137+
)
138+
yaresnet50 = ModelConstructor.from_cfg(
139+
CfgMC(
140+
name='YaResnet50',
141+
block=YaResBlock,
142+
act_fn=Mish(),
143+
expansion=4,
144+
layers=[3, 4, 6, 3],
145+
)
146+
)

0 commit comments

Comments
 (0)