Output from 2 inputs using T5 base model
Hi, below is my python code using t5-base model. I am getting the output as “True” instead of the required output from the inputs. What is wrong in this code? Thanks.from transformers import T5Tokenizer, T5ForConditionalGenerationLoad the pre-trained T5 model and tokenizertokenizer = T5Tokenizer.from_pretrained(‘t5-base’)model = T5ForConditionalGeneration.from_pretrained(‘t5-base’)Define the inputsquestion = “What is the capital of Spain?”answer = “Madrid”Encode the inputsinput_str = “question: {} answer: {}”.format(question, answer)input_ids = tokenizer.encode(input_str, return_tensors=‘pt’)Generate the conclusionoutput_ids = model.generate(input_ids=input_ids, max_length=128, num_beams=4, early_stopping=True)output_str = tokenizer.decode(output_ids[0], skip_special_tokens=True)Print the conclusionprint(output_str)