Due to the depreciation of the single_from_class method of DataBunch, please note that :
- You now need to give the app the export.pkl file download link given by
learner.export()rather than the .pth file given bylearner.save() - No need to create an empty DataBunch, simply create a learner with
load_learner. Here’s what thesetup_learnershould look like in server.py :
async def setup_learner():
await download_file(model_file_url, path/'models'/f'{model_file_name}.pkl')
defaults.device = torch.device('cpu')
learn = load_learner(path/'models', f'{model_file_name}.pkl')
return learn
This is written mainly so that @anurag can update the github repo and the tutorial, but if others are still using the old version be careful it won’t work properly. It’s not throwing an error, but the model isn’t working as it should be.