Lesson 2 - what are the functions "Path" and "download_images"

When downloading images it was never explained where the function Path and download_images came from. When I try to run it, these functions do not exist, do I need to add and import them somehow? They are just not defined at all.


NameError Traceback (most recent call last)
in
----> 1 download_images(path/file, dest, max_pics=200)

NameError: name ‘download_images’ is not defined

I am using Paperspace Gradient, however I could not update fastai library to the last version - it always update to 2.3 version only, and I could get version 3 of the course, so I just cloned the repo from github for course-v3. This may be the reason. However it still would be nice to know, where these function came from.

Path is not a class from fastai but from pythons pathlib, download_images is from fastai.vision.utils. Usually both should be available if you use from fastai.vision.all import *

To specifically import the functions/classes try:

from fastai.vision.utils import download_images 
from pathlib import Path

Version 2.3 is the latest version of fastai, there is no fastai v3 (see fastai/fastai: The fastai deep learning library (github.com)). The version numbering of the courses does not depend on the version of the library and vice versa.

1 Like

Thanks, Keno! I will try using direct import for these functions. I also thought that they should already be available from from fastai.vision.all import *, I wonder why they did not.

I used paperspace gradient and followed steps form https://course19.fast.ai/start_gradient.html.
But on step 3, after updating to the last version of fastai library (which is 2.3 as you said) I can not find course-v3 anywhere, since it is probably not a part of fastai library itself.

Yes, it is also not clear to me why download_images and Path were not loaded with from fastai.vision.all import *. Maybe this is an issue with the public container on paperspace? I have never used paperspace so I can’t help you there, sorry.