T5 user defined loss function

I know I can generate multiple sentences using:
outs = model.generate(input_ids=batch[‘source_ids’].cuda(),
attention_mask=batch[‘source_mask’].cuda(),
max_length=maxlen,do_sample=True, top_k=120,
top_p=0.99,
early_stopping=True,
num_return_sequences=num_return_seq),
and I know how to calculate my metrics based on this ‘outs’.
However, I don’t know how to find this outputs in the return of ‘forward’ function for ’ T5ForConditionalGeneration’.

Also, I couldn’t find the definition for this ‘generate’ function.