Error in the example in the model's card
#5
by
toncho11
- opened
I get an error with the sample code in the model's card.
I think the correct sample code should be:
import torch
from transformers import AutoTokenizer, GPTNeoForCausalLM
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-2.7B")
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-2.7B")
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
input_ids = inputs["input_ids"]
gen_tokens = model.generate(
input_ids,
do_sample=True,
temperature=0.9,
max_length=100,
)
gen_text = tokenizer.batch_decode(gen_tokens)[0]
print(gen_text)
toncho11
changed discussion status to
closed
toncho11
changed discussion status to
open