I am looking for docs that covers how to use pretrained model that is not part of fastai models or torchvision.models, for example PyTorch pretrained BERT (Bidirectional Transformers for NLU) and MobileNet.
I have a vague idea on how this can be achieved:
from fastai import *
from fastai.text import *
# using BertModel class with Google AI's pretrained BERT base uncased model
from pytorch_pretrained_bert import BertModel
# create model. check the PyTorch BERT README
# load pre-trained model (weights). model is a type of torch.nn.Module
model = BertModel.from_pretrained('bert-base-uncased')
# create a DataBunch
data = TextDataBunch.from_folder(path)
# define a Learner object
# this is where the basic training loop is defined
learn = Learner(data, model)
# train
learn.fit(10)