from transformers import TFGPT2LMHeadModel, GPT2Tokenizer model_name = "gpt2" tokenizer = GPT2Tokenizer.from_pretrained(model_name) model = TFGPT2LMHeadModel.from_pretrained(model_name)