Given the following code. why does the function:
model.generate()
returns a summary, where does it order to do summary and not some other task? where can I see the documentation for that as well.
model_name = ‘google/flan-t5-base’
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
dataset_name = “knkarthick/dialogsum”
dataset = load_dataset(dataset_name)
for i in example_indices:
dialog = dataset[‘test’][i][‘dialogue’]
input = tokenizer(dialog,sentence,return_tensors=‘pt’)
ground_truth = dataset[‘test’][i][‘summary’]
model_summary = model.generate(input[‘input_ids’],max_new_tokens=50)
summary = tokenizer.decode(model_summary[0],skip_special_tokens=True)
print(summary)