Currently it is “models”, as a local directory.
Then when directories represent categories, a “new” spurious category “models” appears…
Which then appears as a row and column in confusion_matrix, etc.
I suggest renaming it “.models” as default so it will not be picked up, eg by .ls, etc.
Alternatively/additionally it could be a parameter, eg to ConvLearner.
1 Like
you should be able to override the directory by providing a models_name
model_dir
parameter, as you can see here.
https://github.com/fastai/fastai/blob/master/old/fastai/learner.py#L18- https://github.com/fastai/fastai/blob/master/fastai/basic_train.py#L105
Just pass in an extra parameter called model_dir='.models'
to your ...Learner
instantiation, if you want the weights to be saved in .models
learn = ConvLearner(data, models.resnet152, metrics=accuracy, models_name='.models')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-70-c2a85b42c6e9> in <module>()
----> 1 learn = ConvLearner(data, models.resnet152, metrics=accuracy, models_name='.models') #], pretrained=True)
~/fastai/fastai/vision/learner.py in __init__(self, data, arch, cut, pretrained, lin_ftrs, ps, custom_head, split_on, **kwargs)
56 head = custom_head or create_head(nf, data.c, lin_ftrs, ps)
57 model = nn.Sequential(body, head)
---> 58 super().__init__(data, model, **kwargs)
59 self.split(ifnone(split_on,meta['split']))
60 if pretrained: self.freeze()
TypeError: __init__() got an unexpected keyword argument 'models_name'
I did … but did not work…
The correct name of that argument is model_dir
.
4 Likes
Yes, it is. Thanks!
(I will clean my eyeglasses, did not find it at first…)
1 Like
The pointer above was to the OLD learner…
Oops. My bad ! Glad that you got it going. will update links and description above, so it doesn’t confuse others.