Kindly find the response inline:
from fastai import *
from fastai.vision import *
from fastai.vision import image
model = load_learner("./weights/",‘mobilenetv2_8epochs_best.pkl’)
Was getting NameError: name ‘load_learner’ is not defined in fast ai version 2.0
for fast ai version 1.6 it is working fine
It’s not that it’s not defined, importing in fastai2 is different. Please read the documentation for examples. Also fastai2 is not backwards compatible with v1, so you should do as @Kornel, otherwise you’ll fail.
Hi, I am facing a similar issue.
I have a fastai text model that was trained from fastai v1. It is stored in Microsoft Azure Storage as a block blob and I have been using load_learner to load it from a file path and run it on a model in production.
I have installed fastai v1 with pip install https://github.com/fastai/fastai1/archive/master.zip but that only installs fastai v1.0.34 when I need 1.4.0 to use load_learner.
Alternatively, does fastai v2 have a similiar function to directly load a model from a path and predict with or do I need to retrain my existing model with the new syntax?
Please advise - thank you!
Did you ever get this figured out? I am using fastai v2.4. My model was trained on Google on 2-17-21 after the release of fastai2. I assume that means that my model was created using v2 but I am not positive.
Not sure if that makes a difference seeing as how the error is that load_learner is not defined which in my mind has nothing to do with creating the model as others have suggested.