I am new to transformers and trying to build a question answering chatbot. I use google-t5/t5-large model and it outputs “not_duplicate” for any input question.
`
model = AutoModelForSeq2SeqLM.from_pretrained('google-t5/t5-large').to(device)
tokenizer = AutoTokenizer.from_pretrained('google-t5/t5-large')
def generate_answer(question):
input_text = f"Answer the question:
{question}
Answer:"""
inputs = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
outputs = model.generate(inputs, generation_config=GenerationConfig(max_new_tokens=200,
num_beams=1))
print(outputs[0])
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
return answer
test_question = "Who is Mark Twain?"
print(generate_answer(test_question))
and get this output
tensor([ 0, 59, 834, 26, 413, 26221, 1], device='cuda:0')
not_duplicate
For other kinds of inputs, it generates at least a bad answer, but not “not_duplicate”.
Please help me out.