ayasyrev / model_constructor Goto Github PK
View Code? Open in Web Editor NEWConstructor for pytorch models.
Home Page: https://ayasyrev.github.io/model_constructor/
License: Apache License 2.0
Constructor for pytorch models.
Home Page: https://ayasyrev.github.io/model_constructor/
License: Apache License 2.0
Use in_chans directly.
Create model from config.
Add bias as option / arg
Use validator instead of init.
Add number of groups as divided number (from hidden number)
Remove repeated code.
Use ch_in, ch_out instead of ni, no.
Crate new mc from existing.
Hi there,
great Job on achieving such great results on the imagewoof dataset and thank you for sharing your code! ๐
I noticed that currently your Notebooks are not running anymore. I assume the issue is some incompability with a newver version of fastai.
Just removing the dw and se parameter from net.py fixes the error but I am unsure about the side effects. I'll open a pull request to show you which part I mean.
This is the trace:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-323bb61e297c> in <module>
3 for e in [5]*5 + [20]*5 + [80]:
4 mixup=0 if e<=20 else 0.2
----> 5 learn = get_learn(model=model, size=128, bs=16, mixup=mixup)
6 learn.fit_fc(e, lr=4e-3, moms=(0.95,0.95), start_pct=0.72)
7 acc = learn.recorder.metrics[-1][0].item()
E:\anaconda\envs\fastai\lib\site-packages\imagenette_experiments\train_utils.py in get_learn(gpu, woof, size, alpha, mom, eps, bs, mixup, opt, sa, sym, model, use_gc)
224
225 data = get_data(size, woof, bs)
--> 226 learn = (Learner(data, model(), wd=1e-2, opt_func=opt_func,
227 metrics=[accuracy,top_k_accuracy],
228 bn_wd=False, true_wd=True,
E:\anaconda\envs\fastai\lib\site-packages\model_constructor\net.py in __call__(self)
188 model = nn.Sequential(OrderedDict([
189 ('stem', self.stem),
--> 190 ('body', self.body),
191 ('head', self.head)]))
192 self._init_cnn(model)
E:\anaconda\envs\fastai\lib\site-packages\model_constructor\net.py in body(self)
183 @property
184 def body(self):
--> 185 return self._make_body(self)
186
187 def __call__(self):
E:\anaconda\envs\fastai\lib\site-packages\model_constructor\net.py in _make_body(self)
127 blocks=l, stride=1 if i == 0 else 2,
128 sa=self.sa if i == 0 else False))
--> 129 for i, l in enumerate(self.layers)]
130 return nn.Sequential(OrderedDict(blocks))
131
E:\anaconda\envs\fastai\lib\site-packages\model_constructor\net.py in <listcomp>(.0)
127 blocks=l, stride=1 if i == 0 else 2,
128 sa=self.sa if i == 0 else False))
--> 129 for i, l in enumerate(self.layers)]
130 return nn.Sequential(OrderedDict(blocks))
131
E:\anaconda\envs\fastai\lib\site-packages\model_constructor\net.py in _make_layer(self, expansion, ni, nf, blocks, stride, sa)
118 zero_bn=self.zero_bn, bn_1st=self.bn_1st, groups=self.groups,
119 dw=self.dw, se=self.se))
--> 120 for i in range(blocks)]
121 return nn.Sequential(OrderedDict(layers))
122
E:\anaconda\envs\fastai\lib\site-packages\model_constructor\net.py in <listcomp>(.0)
118 zero_bn=self.zero_bn, bn_1st=self.bn_1st, groups=self.groups,
119 dw=self.dw, se=self.se))
--> 120 for i in range(blocks)]
121 return nn.Sequential(OrderedDict(layers))
122
E:\anaconda\envs\fastai\lib\site-packages\fastai\core.py in _init(self, *args, **kwargs)
64 def _init(self,*args,**kwargs):
65 self.__pre_init__()
---> 66 old_init(self, *args,**kwargs)
67 self.__post_init__()
68 x.__init__ = _init
TypeError: __init__() got an unexpected keyword argument 'dw'
```
Set model name - as name
from MC or MC class name.
Use act funcs w/o inplace option.
Populate objects from string value.
General types.
Protocol for methods.
Move tests from Nbs to pytest.
Separate sat fields and changed.
Try.
Maybe instead of classic inheritance use cls method as constructor.
Clear code, remove nbdev %magic.
migrate to v2
Check typing at MC and layers.
Rename to Modules.
Add Constructors.
Add base abstract class with settings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.