code: def test_training_gradient_checkpointing(self):
      inputs_dict = self.prepare_config_and_inputs()
      encoder_model, decoder_model = self.get_encoder_decoder_model(
          inputs_dict["config"], inputs_dict["decoder_config"]
      )
  
      model = SpeechEncoderDecoderModel(
          encoder=encoder_model, decoder=decoder_model
      )
      model.to(torch_device)
      model.train()
      model.gradient_checkpointing_enable()
      model.config.decoder_start_token_id = 0
      model.config.pad_token_id = 0
  
      model_inputs = {
          "attention_mask": inputs_dict["attention_mask"],
          "labels": inputs_dict["labels"],
          "decoder_input_ids": inputs_dict["decoder_input_ids"],
      }
      inputs = (
          inputs_dict["input_features"]
          if "input_features" in inputs_dict
          else inputs_dict["input_values"]
      )
  
      loss = model(inputs, **model_inputs).loss
      loss.backward()
  
imports: import tempfile
  import unittest
  from transformers import is_torch_available
  from transformers.testing_utils import require_torch, slow, torch_device
  from ...test_modeling_common import floats_tensor, ids_tensor, random_attention_mask
  from ..bert.test_modeling_bert import BertModelTester
  from ..speech_to_text.test_modeling_speech_to_text import Speech2TextModelTester
  from ..speech_to_text_2.test_modeling_speech_to_text_2 import Speech2Text2StandaloneDecoderModelTester
  from ..wav2vec2.test_modeling_wav2vec2 import Wav2Vec2ModelTester
label_desc: Use image node_id 21 for calling the EncoderDecoderMixin obj's underlying member method code with example usage: obj.test_training_gradient_checkpointing() without return types