A walk with fastai2 - Vision - Study Group and Online Lectures Megathread

Are you talking about the initial when it runs for 4 epochs without a learning rate passed in? Or did you pick a learning rate after unfreezing. The second video goes into that :slight_smile:

Usually though this is a sign of too high a learning rate

Hi - yes as you said. The stage_1 is the 4 epoch without lr selection:

learn.fit_one_cycle(4)

0 0.778900 0.356242 0.117050 02:59
1 0.467225 0.255619 0.087957 02:52
2 0.356796 0.193474 0.063599 02:53
3 0.224391 0.182225 0.060893 02:56

learn.save(‘stage_50_1’)

learn.load(‘stage_50_1’);
learn.unfreeze()
learn.fit_one_cycle(4)

0 2.763947 2.991710 0.771313 03:56
1 2.097217 2.034349 0.544655 03:57
2 1.139667 0.773863 0.256428 03:47
3 0.717175 0.553673 0.174560 03:49

learn.load(‘stage_50_1’);
learn.fit_one_cycle(4, lr_max=slice(1e-6, 1e-4))

0 0.222867 0.176986 0.061570 04:01
1 0.192644 0.200198 0.067659 03:51
2 0.141736 0.183223 0.058863 03:48
3 0.130169 0.172185 0.055480 03:55

BTW I really appreciate you setting up this course !! Having a fixed point in the week with deliverables and new info is cool. Easy to plan into a busy week.

This is due to not picking a learning rate. What winds you happening is the one chosen is too fast and we lose accuracy :slight_smile:

Hence why when we try it again with a proper learning rate, we do much better

For those on a windows box, the following RegEx works for our kind of file names: :wink:

path = untar_data(URLs.PETS)
fnames = get_image_files(path/‘images’)
pat = r’([^\]+)_\d+.jpg$'

pets = DataBlock(blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=RandomSplitter(),
get_y=RegexLabeller(pat = pat))

1 Like

OK - that explains things. Thanks for your answer.

Do we need specific Python version > 3.6 for this course/fastai v2. I have Python 3.6 installed and am getting the error below when I execute dbunch.show_batch(max_n=9, figsize=(6, 7))
I do have PyTorch version 1.4 installed.


AttributeError Traceback (most recent call last)
in ()
----> 1 dbunch.show_batch(max_n=9, figsize=(6,7))

6 frames
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in getattr(self, k)
221 attr = getattr(self,self._default,None)
222 if attr is not None: return getattr(attr, k)
–> 223 raise AttributeError(k)
224 def dir(self): return custom_dir(self, self._dir() if self._xtra is None else self._dir())
225 # def getstate(self): return self.dict

AttributeError: _IterableDataset_len_called

1 Like

No, you shouldn’t. I’d recommend posting in the fastai2 chat. The requirements are >=3.6 for python and >=1.2.0 for pytorch

I just got this same error using Google Colab.

1 Like

How are you installing the library? @shakur and @Srinivas

I was just running the repository notebook. So I did not make any changes.

1 Like

Hmmmm. I’ll investigate

Same here. I did not change anything in the first notebook. Just followed it.

I’m running it on collab too and it is giving me the same error.
tried running this:


mnist = DataBlock(blocks=(ImageBlock(cls=PILImageBW), CategoryBlock), 
                  get_items=get_image_files, 
                  splitter=GrandparentSplitter(),
                  get_y=parent_label)

dbunch = mnist.databunch(untar_data(URLs.MNIST_TINY))
dbunch.show_batch(max_n=9, figsize=(4,4))

from https://github.com/fastai/fastai2/blob/master/nbs/50_datablock_examples.ipynb and i’m getting the same error

I have a hunch it’s torchvision. Confirming now but they just pushed 0.5.0 today.

Edit yup, that was it. !pip install torchvision===0.4.2

Use this. I will update the notebooks and the colab install directions. @jeremy or @sgugger I’d recommend updating the requirements for fastai2 as well.

For convenience, the function is now:

import os
!pip install -q fastai2 fastcore feather-format kornia pyarrow wandb nbdev fastprogress --upgrade 
!pip install torchvision===0.4.2
!pip install Pillow==6.2.1
os._exit(00)

I’ll edit the course nb’s tommorow

5 Likes

@muellerzr Great work, and enjoy it.

Just wondering when will the block 2 materials on tabular stuff be available?

I’ll be working on them Incrementally (in between school and whatnot). In the meantime I’ll put the old tabular and NLP notebooks back up for people to look at. At the absolute latest mid/late February.

THANKS for the quick update. Works for me now.
When I run the pip install commands and when it does the Pillow install I see the following error:
ERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you’ll have imgaug 0.2.9 which is incompatible.
It does go through and install Pillow 6.2.1 after uninstalling 6.2.2
Is that as expected?

Yes. We do not want 6.2.2 (though I removed the —upgrade, I’m unsure on how that behavior works, learning pip package syntax still somewhat :slight_smile: )

ok thx - also will we be using albumentations library to perform data augmentation?

That I’m not 100% sure of. But all augmentation works with this setup :slight_smile:

*as of writing this.