A question about the modeling_bart.py

I have a question about one part.

Why the BartModel return not just decoder_outputs
and need to be decoder_outputs + encoder_outputs
Thank you.

Because when you do generation you usually do a single pass in the encoder and reuse it’s output for the subsequent token generation for efficiency so you need to access the encoder output from the first forward pass.

1 Like