Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

text generate gpt 2 huggingface

from transformers import GPT2Tokenizer, TFGPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = TFGPT2Model.from_pretrained('gpt2')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
Source by huggingface.co #
 
PREVIOUS NEXT
Tagged: #text #generate #gpt #huggingface
ADD COMMENT
Topic
Name
3+6 =