Skip to content

Commit b8d7160

Browse files
author
ayasyrev
committed
v0.1.5 YaResnet, MXResNet, Mish
1 parent 55bbbca commit b8d7160

File tree

10 files changed

+1755
-228
lines changed

10 files changed

+1755
-228
lines changed

README.md

Lines changed: 533 additions & 91 deletions
Large diffs are not rendered by default.

docs/Net.html

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h1 id="ResBlock">ResBlock<a class="anchor-link" href="#ResBlock"> </a></h1>
102102

103103

104104
<div class="output_markdown rendered_html output_subarea ">
105-
<h2 id="ResBlock" class="doc_header"><code>class</code> <code>ResBlock</code><a href="https://github.com/ayasyrev/model_constructor/tree/master/model_constructor/layers.py#L209" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>ResBlock</code>(<strong><code>ni</code></strong>, <strong><code>nh</code></strong>, <strong><code>expansion</code></strong>=<em><code>1</code></em>, <strong><code>stride</code></strong>=<em><code>1</code></em>, <strong><code>conv_layer</code></strong>=<em><code>'ConvLayer'</code></em>, <strong><code>conv_block</code></strong>=<em><code>'ConvBlockBasic'</code></em>, <strong><code>downsample</code></strong>=<em><code>'DownsampleLayer'</code></em>, <strong><code>act_fn</code></strong>=<em><code>ReLU(inplace=True)</code></em>, <strong><code>act_id</code></strong>=<em><code>False</code></em>, <strong><code>zero_bn</code></strong>=<em><code>True</code></em>, <strong><code>sa</code></strong>=<em><code>False</code></em>, <strong><code>sym</code></strong>=<em><code>False</code></em>, <strong>**<code>kwargs</code></strong>) :: <code>Module</code></p>
105+
<h2 id="ResBlock" class="doc_header"><code>class</code> <code>ResBlock</code><a href="https://github.com/ayasyrev/model_constructor/tree/master/model_constructor/layers.py#L210" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>ResBlock</code>(<strong><code>ni</code></strong>, <strong><code>nh</code></strong>, <strong><code>expansion</code></strong>=<em><code>1</code></em>, <strong><code>stride</code></strong>=<em><code>1</code></em>, <strong><code>conv_layer</code></strong>=<em><code>'ConvLayer'</code></em>, <strong><code>conv_block</code></strong>=<em><code>'ConvBlockBasic'</code></em>, <strong><code>downsample</code></strong>=<em><code>'DownsampleLayer'</code></em>, <strong><code>act_fn</code></strong>=<em><code>ReLU(inplace=True)</code></em>, <strong><code>act_id</code></strong>=<em><code>False</code></em>, <strong><code>zero_bn</code></strong>=<em><code>True</code></em>, <strong><code>sa</code></strong>=<em><code>False</code></em>, <strong><code>sym</code></strong>=<em><code>False</code></em>, <strong>**<code>kwargs</code></strong>) :: <code>Module</code></p>
106106
</blockquote>
107107
<p>Base class for all neural network modules.</p>
108108
<p>Your models should also subclass this class.</p>
@@ -293,6 +293,14 @@ <h2 id="ResBlock" class="doc_header"><code>class</code> <code>ResBlock</code><a
293293
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
294294
<div class="text_cell_render border-box-sizing rendered_html">
295295
<h1 id="NewResBlock">NewResBlock<a class="anchor-link" href="#NewResBlock"> </a></h1>
296+
</div>
297+
</div>
298+
</div>
299+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
300+
<div class="text_cell_render border-box-sizing rendered_html">
301+
<p>NewResBlock now is YaResBlock - Yet Another ResNet Block! It is now at model_constructor.yaresnet.
302+
Here i left old name for compatibility with existing Notebooks.</p>
303+
296304
</div>
297305
</div>
298306
</div>
@@ -345,6 +353,24 @@ <h2 id="NewResBlock" class="doc_header"><code>class</code> <code>NewResBlock</co
345353
</div>
346354
</div>
347355

356+
</div>
357+
{% endraw %}
358+
359+
{% raw %}
360+
361+
<div class="cell border-box-sizing code_cell rendered">
362+
<div class="input">
363+
364+
<div class="inner_cell">
365+
<div class="input_area">
366+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># from model_constructor.yaresnet import YaResBlock</span>
367+
<span class="c1"># NewResBlock = YaResBlock</span>
368+
</pre></div>
369+
370+
</div>
371+
</div>
372+
</div>
373+
348374
</div>
349375
{% endraw %}
350376

@@ -434,6 +460,25 @@ <h2 id="Net" class="doc_header"><code>class</code> <code>Net</code><a href="http
434460
</div>
435461
</div>
436462

463+
<div class="output_wrapper">
464+
<div class="output">
465+
466+
<div class="output_area">
467+
468+
469+
470+
<div class="output_text output_subarea output_execute_result">
471+
<pre>Net constructor
472+
expansion: 1, sa: 0, groups: 1
473+
stem sizes: [3, 32, 32, 64]
474+
body sizes [64, 64, 128, 256, 512]</pre>
475+
</div>
476+
477+
</div>
478+
479+
</div>
480+
</div>
481+
437482
</div>
438483
{% endraw %}
439484

docs/index.html

Lines changed: 621 additions & 55 deletions
Large diffs are not rendered by default.

docs/layers.html

Lines changed: 20 additions & 11 deletions
Large diffs are not rendered by default.

model_constructor/layers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def forward(self, x):
5555
# Mish: Self Regularized
5656
# Non-Monotonic Activation Function
5757
# https://github.com/digantamisra98/Mish
58+
# fastai forum discussion https://forums.fast.ai/t/meet-mish-new-activation-function-possible-successor-to-relu
5859

5960
class Mish(nn.Module):
6061
'''Self Regularized Non-Monotonic Activation Function'''

model_constructor/net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, expansion, ni, nh, stride=1,
4242
def forward(self, x): return self.act_fn(self.convs(x) + self.idconv(self.pool(x)))
4343

4444
# Cell
45-
# Still no name - just New block YET!
45+
# NewResBlock now is YaResBlock - Yet Another ResNet Block! It is now at model_constructor.yaresnet.
4646
class NewResBlock(nn.Module):
4747
def __init__(self, expansion, ni, nh, stride=1,
4848
conv_layer=ConvLayer, act_fn=act_fn, zero_bn=True, bn_1st=True,

nbs/01_layers.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@
275275
"# Mish"
276276
]
277277
},
278+
{
279+
"cell_type": "markdown",
280+
"metadata": {},
281+
"source": [
282+
"Mish - Self Regularized Non-Monotonic Activation Function \n",
283+
"https://github.com/digantamisra98/Mish \n",
284+
"fastai forum discussion https://forums.fast.ai/t/meet-mish-new-activation-function-possible-successor-to-relu "
285+
]
286+
},
278287
{
279288
"cell_type": "code",
280289
"execution_count": null,
@@ -285,6 +294,7 @@
285294
"# Mish: Self Regularized\n",
286295
"# Non-Monotonic Activation Function\n",
287296
"# https://github.com/digantamisra98/Mish\n",
297+
"# fastai forum discussion https://forums.fast.ai/t/meet-mish-new-activation-function-possible-successor-to-relu\n",
288298
"\n",
289299
"class Mish(nn.Module):\n",
290300
" '''Self Regularized Non-Monotonic Activation Function'''\n",

nbs/04_Net.ipynb

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,22 @@
253253
"# NewResBlock"
254254
]
255255
},
256+
{
257+
"cell_type": "markdown",
258+
"metadata": {},
259+
"source": [
260+
"NewResBlock now is YaResBlock - Yet Another ResNet Block! It is now at model_constructor.yaresnet.\n",
261+
"Here i left old name for compatibility with existing Notebooks."
262+
]
263+
},
256264
{
257265
"cell_type": "code",
258266
"execution_count": null,
259267
"metadata": {},
260268
"outputs": [],
261269
"source": [
262270
"%nbdev_export\n",
263-
"# Still no name - just New block YET!\n",
271+
"# NewResBlock now is YaResBlock - Yet Another ResNet Block! It is now at model_constructor.yaresnet.\n",
264272
"class NewResBlock(nn.Module):\n",
265273
" def __init__(self, expansion, ni, nh, stride=1, \n",
266274
" conv_layer=ConvLayer, act_fn=act_fn, zero_bn=True, bn_1st=True,\n",
@@ -285,6 +293,17 @@
285293
" return self.merge(self.convs(o) + self.idconv(o))"
286294
]
287295
},
296+
{
297+
"cell_type": "code",
298+
"execution_count": null,
299+
"metadata": {},
300+
"outputs": [],
301+
"source": [
302+
"# %nbdev_export\n",
303+
"# from model_constructor.yaresnet import YaResBlock\n",
304+
"# NewResBlock = YaResBlock"
305+
]
306+
},
288307
{
289308
"cell_type": "code",
290309
"execution_count": null,
@@ -624,7 +643,21 @@
624643
"cell_type": "code",
625644
"execution_count": null,
626645
"metadata": {},
627-
"outputs": [],
646+
"outputs": [
647+
{
648+
"data": {
649+
"text/plain": [
650+
"Net constructor\n",
651+
" expansion: 1, sa: 0, groups: 1\n",
652+
" stem sizes: [3, 32, 32, 64]\n",
653+
" body sizes [64, 64, 128, 256, 512]"
654+
]
655+
},
656+
"execution_count": null,
657+
"metadata": {},
658+
"output_type": "execute_result"
659+
}
660+
],
628661
"source": [
629662
"model = Net()\n",
630663
"model"
@@ -1789,6 +1822,7 @@
17891822
"Converted 04_Net.ipynb.\n",
17901823
"Converted 05_Twist.ipynb.\n",
17911824
"Converted 06_YaResNet.ipynb.\n",
1825+
"Converted 07_MXResNet.ipynb.\n",
17921826
"Converted index.ipynb.\n"
17931827
]
17941828
}

0 commit comments

Comments
 (0)