Gpt-neox-20b

#27
by Shubham1611 - opened

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_name = "EleutherAI/gpt-neox-20b"
tokenizer = AutoTokenizer.from_pretrained(model_name)

model = AutoModelForCausalLM.from_pretrained(model_name)

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

prompt = "Write 3 behavioral interview questions about leadership."

input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)

outputs = model.generate(
input_ids=input_ids,
max_length=200,
num_beams=4,
no_repeat_ngram_size=2
)

generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)

This is my code but i am receiving no output. I am unable to understand the reason behind this.

Sign up or log in to comment