Live coding 9

That means you don’t have the latest fastai on paperspace.

1 Like

The last container paperspace pushed was about 2 months ago. Maybe I’m reading it wrong but looks like they’re cloning fastcore and fastai and doing a pip install in both directories. Not sure if that’s the canonical way to install fastai. At least that’s what I gleaned looked at their latest published tag for the fastai template env on dockerhub.

Ah. thx.
At the top of my scripts I watch the version with…

fastai.__version__

2.6.3

which was the latest last week, and then I blindly presumed…

setup_comp(comp, install='"fastcore>=1.4.5" "fastai>=2.7.1" "timm>=0.6.2.dev0"')

…was taking care of everything, without actually noticing the 2.7.1 that I’d skimmed over thinking it was another package.

2.7.3 is now installed and it works properly.

But, why are the pre-requisite installs only done for Kaggle?

def setup_comp(competition, install=''):
    "Get a path to data for `competition`, downloading it if needed"
    if iskaggle:
        if install:
            os.system(f'pip install -Uqq {install}')
        return Path('../input')/competition
    else:
        path = Path(competition)
        from kaggle import api
        if not path.exists():
            import zipfile
            api.competition_download_cli(str(competition))
            zipfile.ZipFile(f'{competition}.zip').extractall(str(competition))
        return path

It also might help for users to be advised they need to restart their kernel when a version upgrade occurs. Maybe something roughly like…

def setup_comp(competition, install=''):
   "Get a path to data for `competition`, downloading it if needed"
   if install:
       oldver = !pip show fastai | grep Version | sed 's/Version: //'
       os.system(f'pip install -Uqq {install}')
       newver = !pip show fastai | grep Version | sed 's/Version: //'
       if oldver[0] != newver[0]: print ('Please restart kernel to ensure upgraded version loaded.')

   if iskaggle:
       path = Path('../input')/competition
   else:
       path = Path(competition)
       from kaggle import api
       if not path.exists():
           import zipfile
           api.competition_download_cli(str(competition))
           zipfile.ZipFile(f'{competition}.zip').extractall(str(competition))
   return path

Because on Kaggle you always have to install because there’s no persistent environment. Elsewhere you don’t need to update from pip every time you run a notebook.

1 Like

I would find it useful, for the pre-requisite install to apply to non-kaggle platforms, so thought I’d have a go at a code contribution. I submitted an issue on github to discuss this:

I’m interested in getting broad feedback on whether this would be useful to others.

1 Like

Hi, I have been working my way through these live coding sessions but notice that my training on Paperspace is taking much longer than in the video. When I run

vision_learner(dls, ‘convnext_small_in22k’, metrics=error_rate).to_fp16()

Each epoch takes around 4:40 minutes while it looks like each epoch takes around 35s in the video. According to nvidia-smi dmon GPU utilisation is around 100%. Storing training data in /root. I am running the notebook on a Free-P5000 instance in a paid account. Any suggestions on how I can speed up training would be much appreciated. Thanks!

hi @Tomasaki, You don’t mention what GPU Jeremy is using during the sessions (I’m not sure if that is ever visible) so I’d imagine Jeremy used a higher performing paid-instance, so as to not waste the time of those people participating in the session.

1 Like

Thanks @bencoman for pointing that out to me. I was thinking of session 7 where he is running this instance type on Paperspace.