Skip to content

Instantly share code, notes, and snippets.

@LysandreJik LysandreJik/model_load.py Secret
Last active Oct 22, 2019

Embed
What would you like to do?
Loading a model and tokenizer
from transformers import (TFBertModel, BertTokenizer,
TFGPT2Model, GPT2Tokenizer)
bert_model = TFBertModel.from_pretrained("bert-base-cased") # Automatically loads the config
bert_tokenizer = BertTokenizer.from_pretrained("bert-base-cased")
gpt2_model = TFGPT2Model.from_pretrained("gpt2") # Automatically loads the config
gpt2_tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.