Skip to content

Commit 5f0c17b

Browse files
committed
fix docs
1 parent bf1a2c6 commit 5f0c17b

23 files changed

+3087
-1251
lines changed

Nbs/01_activations.ipynb

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,54 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"metadata": {},
65
"source": [
76
"# Activations functions.\n",
87
"\n",
98
"> Activations functions. Set of act_fn."
10-
]
9+
],
10+
"metadata": {}
1111
},
1212
{
1313
"cell_type": "markdown",
14-
"metadata": {},
1514
"source": [
1615
"Activation functions, forked from https://github.com/rwightman/pytorch-image-models/timm/models/layers/activations.py"
17-
]
16+
],
17+
"metadata": {}
1818
},
1919
{
2020
"cell_type": "markdown",
21-
"metadata": {},
2221
"source": [
2322
"Mish: Self Regularized \n",
2423
"Non-Monotonic Activation Function \n",
2524
"https://github.com/digantamisra98/Mish \n",
2625
"fastai forum discussion https://forums.fast.ai/t/meet-mish-new-activation-function-possible-successor-to-relu "
27-
]
26+
],
27+
"metadata": {}
2828
},
2929
{
3030
"cell_type": "code",
3131
"execution_count": null,
32-
"metadata": {},
33-
"outputs": [],
3432
"source": [
33+
"# hide\n",
3534
"# forked from https://github.com/rwightman/pytorch-image-models/timm/models/layers/activations.py\n",
35+
"\n",
3636
"import torch\n",
3737
"from torch import nn as nn\n",
3838
"from torch.nn import functional as F"
39-
]
39+
],
40+
"outputs": [],
41+
"metadata": {}
4042
},
4143
{
4244
"cell_type": "markdown",
43-
"metadata": {},
4445
"source": [
45-
"# Mish"
46-
]
46+
"## Mish"
47+
],
48+
"metadata": {}
4749
},
4850
{
4951
"cell_type": "code",
5052
"execution_count": null,
51-
"metadata": {},
52-
"outputs": [],
5353
"source": [
5454
"def mish(x, inplace: bool = False):\n",
5555
" \"\"\"Mish: A Self Regularized Non-Monotonic Neural Activation Function - https://arxiv.org/abs/1908.08681\n",
@@ -66,20 +66,20 @@
6666
"\n",
6767
" def forward(self, x):\n",
6868
" return mish(x)"
69-
]
69+
],
70+
"outputs": [],
71+
"metadata": {}
7072
},
7173
{
7274
"cell_type": "markdown",
73-
"metadata": {},
7475
"source": [
75-
"# MishJit"
76-
]
76+
"## MishJit"
77+
],
78+
"metadata": {}
7779
},
7880
{
7981
"cell_type": "code",
8082
"execution_count": null,
81-
"metadata": {},
82-
"outputs": [],
8383
"source": [
8484
"@torch.jit.script\n",
8585
"def mish_jit(x, _inplace: bool = False):\n",
@@ -97,20 +97,20 @@
9797
"\n",
9898
" def forward(self, x):\n",
9999
" return mish_jit(x)"
100-
]
100+
],
101+
"outputs": [],
102+
"metadata": {}
101103
},
102104
{
103105
"cell_type": "markdown",
104-
"metadata": {},
105106
"source": [
106-
"# MishJitMe - memory-efficient."
107-
]
107+
"## MishJitMe - memory-efficient."
108+
],
109+
"metadata": {}
108110
},
109111
{
110112
"cell_type": "code",
111113
"execution_count": null,
112-
"metadata": {},
113-
"outputs": [],
114114
"source": [
115115
"@torch.jit.script\n",
116116
"def mish_jit_fwd(x):\n",
@@ -151,20 +151,20 @@
151151
"\n",
152152
" def forward(self, x):\n",
153153
" return MishJitAutoFn.apply(x)"
154-
]
154+
],
155+
"outputs": [],
156+
"metadata": {}
155157
},
156158
{
157159
"cell_type": "markdown",
158-
"metadata": {},
159160
"source": [
160-
"# HardMishJit"
161-
]
161+
"## HardMishJit"
162+
],
163+
"metadata": {}
162164
},
163165
{
164166
"cell_type": "code",
165167
"execution_count": null,
166-
"metadata": {},
167-
"outputs": [],
168168
"source": [
169169
"@torch.jit.script\n",
170170
"def hard_mish_jit(x, inplace: bool = False):\n",
@@ -185,20 +185,20 @@
185185
"\n",
186186
" def forward(self, x):\n",
187187
" return hard_mish_jit(x)"
188-
]
188+
],
189+
"outputs": [],
190+
"metadata": {}
189191
},
190192
{
191193
"cell_type": "markdown",
192-
"metadata": {},
193194
"source": [
194-
"# HardMishJitMe - memory efficient."
195-
]
195+
"## HardMishJitMe - memory efficient."
196+
],
197+
"metadata": {}
196198
},
197199
{
198200
"cell_type": "code",
199201
"execution_count": null,
200-
"metadata": {},
201-
"outputs": [],
202202
"source": [
203203
"@torch.jit.script\n",
204204
"def hard_mish_jit_fwd(x):\n",
@@ -242,26 +242,28 @@
242242
"\n",
243243
" def forward(self, x):\n",
244244
" return HardMishJitAutoFn.apply(x)"
245-
]
245+
],
246+
"outputs": [],
247+
"metadata": {}
246248
},
247249
{
248250
"cell_type": "code",
249251
"execution_count": null,
250-
"metadata": {},
251-
"outputs": [],
252252
"source": [
253253
"#hide\n",
254254
"act_fn = Mish(inplace=True)"
255-
]
255+
],
256+
"outputs": [],
257+
"metadata": {}
256258
},
257259
{
258260
"cell_type": "markdown",
259-
"metadata": {},
260261
"source": [
261262
"# end\n",
262263
"model_constructor\n",
263264
"by ayasyrev"
264-
]
265+
],
266+
"metadata": {}
265267
}
266268
],
267269
"metadata": {
@@ -298,4 +300,4 @@
298300
},
299301
"nbformat": 4,
300302
"nbformat_minor": 2
301-
}
303+
}

Nbs/01_layers.ipynb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
"cell_type": "code",
251251
"execution_count": 10,
252252
"source": [
253+
"#collapse_output\n",
253254
"conv_layer = ConvLayer(32, 64, act=False)\n",
254255
"conv_layer"
255256
],
@@ -279,6 +280,7 @@
279280
"cell_type": "code",
280281
"execution_count": 11,
281282
"source": [
283+
"#collapse_output\n",
282284
"conv_layer = ConvLayer(32, 64, bn_layer=False)\n",
283285
"conv_layer"
284286
],
@@ -308,6 +310,7 @@
308310
"cell_type": "code",
309311
"execution_count": 12,
310312
"source": [
313+
"#collapse_output\n",
311314
"conv_layer = ConvLayer(32, 64, bn_1st=True)\n",
312315
"conv_layer"
313316
],
@@ -338,6 +341,7 @@
338341
"cell_type": "code",
339342
"execution_count": 13,
340343
"source": [
344+
"#collapse_output\n",
341345
"conv_layer = ConvLayer(32, 64, bn_1st=True, act_fn=nn.LeakyReLU())\n",
342346
"conv_layer"
343347
],
@@ -516,6 +520,7 @@
516520
"cell_type": "code",
517521
"execution_count": 21,
518522
"source": [
523+
"#collapse_output\n",
519524
"se_block = SEBlock(128)\n",
520525
"se_block"
521526
],
@@ -612,6 +617,7 @@
612617
"cell_type": "code",
613618
"execution_count": 24,
614619
"source": [
620+
"#collapse_output\n",
615621
"se_block = SEBlockConv(128)\n",
616622
"se_block"
617623
],

Nbs/03_MXResNet.ipynb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@
2222
"source": [
2323
"#hide\n",
2424
"from fastcore.test import *\n",
25-
"import torch\n"
26-
],
27-
"outputs": [],
28-
"metadata": {}
29-
},
30-
{
31-
"cell_type": "code",
32-
"execution_count": null,
33-
"source": [
25+
"import torch\n",
3426
"from functools import partial\n",
3527
"\n",
3628
"from model_constructor.activations import Mish\n",
@@ -42,7 +34,7 @@
4234
{
4335
"cell_type": "markdown",
4436
"source": [
45-
"# MXResNet constructor."
37+
"## MXResNet constructor."
4638
],
4739
"metadata": {}
4840
},
@@ -522,6 +514,13 @@
522514
],
523515
"metadata": {}
524516
},
517+
{
518+
"cell_type": "markdown",
519+
"source": [
520+
"## MxResNet constructors"
521+
],
522+
"metadata": {}
523+
},
525524
{
526525
"cell_type": "code",
527526
"execution_count": null,

0 commit comments

Comments
 (0)