[EncoderDecoderModel] Add support for gradient checkpointing
# What does this PR do?

This PR adds gradient checkpointing support for EncoderDecoderModel in PyTorch.

As requested on the forum: https://discuss.huggingface.co/t/feature-request-gradient-checkpointing-for-encoderdecodermodel/25278
_The documentation is not available anymore as the PR was closed or merged._