Spaces:
Sleeping
Sleeping
from transformers import GPT2LMHeadModel, GPT2Tokenizer | |
model_id = "gpt2" | |
model = GPT2LMHeadModel.from_pretrained(model_id) | |
tokenizer = GPT2Tokenizer.from_pretrained(model_id) | |
text = "Hello" | |
encoded_text = tokenizer(text, return_tensors="pt") | |
outputs = model(**encoded_text) |