Model templates encoder only
Only merge the encoder part, not the encoder-decoder part of #7636. 

Will work on a decoder in the future.

Applied your comments @sgugger @patrickvonplaten, but opened a new PR on a new branch so that we can keep the old one for reference when integrating the encoder-decoder model.
Thank you both for your reviews!