I just started out with course-v3 and was stumped to see that Jeremy imported the fastai library twice(I could be wrong here?). My point is why is it necessary to do this;
from fastai import *
from fastai.vision import *
Shouldn’t it be possible to directly import everything from the first
import statement itself?
Does it work when you just try the first line?
Try reading the docs on import * and have a look at the source code of fastai to see why you need both.
Could you change the source code so you don’t need the second line? Why might this be a bad idea? (Hint: think about what matters when solving columnar, text and collaborative filtering problems)
Ah it makes a lot more sense now, so if I’m right does
from fastai import * import only the
core aspects of the fastai library? While
from fastai.vision import * imports only the
vision aspects of the library?
I believe I found an answer to that doubt over here at Module Structure | Imports! But regardless I want some clarity if I’m on the right path.
Yep; that’s right!
The idea is you’ll need the core parts for pretty much any deep learning problem so you’ll always want to import them.
Whereas the application specific time takes some time to load, so you’ll want to only import
fastai.vision if you’re working on vision problems (rather than