Hey @farlion not at a computer but looking at the error I wanted to check, there have been a few changes to the fastai libraries a few days ago Including conv_learner, looks like you are using the older versions, if so can you update the library and then re try.
Hi, @farlion you might want to find “self.linear = nn.Linear(4032, self.num_classes)” on line 548 in nasnet.py and modify it as follow:
Also, if you happen to copy the file from Cadene github, you might want to remove the code highlighted below because you would get another error (output size is too small because of pooling).
Unfortunately, haven’t gotten it running yet.
Fastai lib (from github repo) is at latest stage, and I’m using the default Paperspace setup with up-to-date conda env.
When I try the modification suggested by @YJP, I get the following:
The way I tried was using fastai nasnet.py as a base then just copied and pasted ‘def nasnetlarge’ function only from the Cadene github version (In this version, they do not have the first argument; only ). Then I changed ‘self.linear = nn.Linear(4032, self.num_classes)’ to 'self.last_linear = nn.Linear(4032, self.num_classes).
When you use the Cadene github version, please also check two places with the variable ‘num_classes’ in nasnet.py below:
I am not sure whether this is the appropriate way to resolve this issue but at least I found the model started to work in this way. Hope this works for you.
Hmm thank you @YJP, I tried your approach, giving me the same error.
I then added the use_classifer=False param back, which got the model to download (with the new URLs from Cadene), but then it fails again with:
RuntimeError: Given input size: (4032x7x7). Calculated output size: (4032x-3x-3). Output size is too small at /opt/conda/conda-bld/pytorch_1503965122592/work/torch/lib/THCUNN/generic/SpatialAveragePooling.cu:63
Copy the code section for ‘def nasnetalarge’ from Cadene’s nasnet.py to the current jupyter notebook version.
Change num_classes from 1001 to 1000.
Change self.linear to self.last_linear
I started to train the model and will see how it goes in terms of accuracy and loss. I think num_classes is the number of classes/classification that we want to predict so this may have to be adjusted once the model started to work. I will experiment to see whether adjusting this number makes difference.
I think your nasnet.py is the version from Cadene’s github, which has the different code from fastai version.
Line 582 on your version has “def logits(self, features):” which includes “x = self.avg_pool(x)”.
For the same position in fastai version, it has the following code, which does not contain “self.avg_pool”:
Please refer to my previous post (my base is a fastai version) though farlion tried and still has a problem that I cannot replicate.
I made it start to work but I am still training to see whether this model generates an appropriate accuracy and loss first (it seems this takes for a while).
Sorry, but I am not used to all these terms but what is a PR in this context? Pull Request? Thank you.
I have another question, as Nasnet large is slow and computationally expensive, do you think playing around with the cell sizes will help reduce computational costs?
I also wanted to confirm the in-channels_left and out_channels_left, are these image sizes?
Are you still having an issue with nasnet.py? If so, could you please try the version I posted in the github and let me know whether it works or not? Thank you in advance.