I have an nlp test dataset that I’m trying to do inference on. I have a language model and it works if I do learn.predict on a single record. There are two issues I can’t seem to resolve when trying to do it on a test set:
For problem 1 you can get test_dl.get_idxs() and use that to sort your predictions in the original order. Unfortunately it seems that in fastai v2 there is no easier way to get sorted predictions for NLP.
I didn’t really understand the second issue. Could you describe the problem in a bit more detail?
You’re not making a test set here, you’re making entirely new dataloaders to train on. You should take your existing DataLoader and use dl = dls.test_dl(test_df)
If you can’t do the above then a step was skipped along the way. This should be after your model is trained. Even upon export (learn.export) you should be able to run this
Matthew SF Choo also posted a medium article showing a bit more work. I copied his functions and with some slight changes have been inferring with models. The article is called, " Making NLP predictions on new datasets using Fast.ai"