I am using fastai v2.0.15 and no matter what I pass into predict I get
/opt/conda/lib/python3.6/site-packages/fastai/learner.py in predict(self, item, rm_type_tfms, with_input)
245
246 def predict(self, item, rm_type_tfms=None, with_input=False):
--> 247 dl = self.dls.test_dl([item], rm_type_tfms=rm_type_tfms, num_workers=0)
248 inp,preds,_,dec_preds = self.get_preds(dl=dl, with_input=True, with_decoded=True)
249 i = getattr(self.dls, 'n_inp', -1) ...
... TypeError: list indices must be integers or slices, not list
I’ve tried everything from the forum & other sources & also tried even passing in None types or anything at all. Same result. I’m wondering is it something to do with my environment or something else?
And I create a single DataLoader object from the same DataLoaders object that was used to train the model, even trying to replicate the source code for Learner.get_preds():
Alright, I figured it out, at least for my use case. The new DataLoader needs to be created by passing the new DataFrame into learn.dls.test_dl(). Then you can call learn.get_preds() with the new DataLoader: