Saving a model | |
To export a BertModel with TorchScript, instantiate BertModel from the BertConfig | |
class and then save it to disk under the filename traced_bert.pt: | |
thon | |
from transformers import BertModel, BertTokenizer, BertConfig | |
import torch | |
enc = BertTokenizer.from_pretrained("google-bert/bert-base-uncased") | |
Tokenizing input text | |
text = "[CLS] Who was Jim Henson ? |