code: def test_pretrained_checkpoint_hidden_states(self):
      model = XLMProphetNetForConditionalGeneration.from_pretrained(
          "microsoft/xprophetnet-large-wiki100-cased"
      )
      model.to(torch_device)
  
      # encoder-decoder outputs
      encoder_ids = torch.tensor([[17, 96208, 103471, 2]]).to(
          torch_device
      )
      decoder_prev_ids = torch.tensor(
          [
              [
                  2,
                  250,
                  9953,
                  34,
                  69489,
                  1620,
                  32,
                  118424,
                  624,
                  210,
                  105,
                  2913,
                  1032,
                  351,
              ]
          ]
      ).to(torch_device)
      output = model(
          input_ids=encoder_ids,
          attention_mask=None,
          encoder_outputs=None,
          decoder_input_ids=decoder_prev_ids,
      )
      output_predited_logis = output[0]
      expected_shape = torch.Size((1, 14, 250012))
      self.assertEqual(output_predited_logis.shape, expected_shape)
      expected_slice = torch.tensor(
          [
              [
                  [-6.6042, -8.3838, 12.4717],
                  [-6.4426, -8.1994, 12.4542],
                  [-6.0851, -7.8209, 12.9493],
              ]
          ]
      ).to(torch_device)
      self.assertTrue(
          torch.allclose(
              output_predited_logis[:, :3, :3],
              expected_slice,
              atol=1e-4,
          )
      )
  
      # encoder outputs
      encoder_outputs = model.prophetnet.encoder(encoder_ids)[0]
      expected_encoder_outputs_slice = torch.tensor(
          [
              [
                  [-1.4260, -0.7628, 0.8453],
                  [-1.4719, -0.1391, 0.7807],
                  [-1.7678, 0.0114, 0.4646],
              ]
          ]
      ).to(torch_device)
      expected_shape_encoder = torch.Size((1, 4, 1024))
      self.assertEqual(encoder_outputs.shape, expected_shape_encoder)
      self.assertTrue(
          torch.allclose(
              encoder_outputs[:, :3, :3],
              expected_encoder_outputs_slice,
              atol=1e-4,
          )
      )
  
      # decoder outputs
      decoder_outputs = model.prophetnet.decoder(
          decoder_prev_ids,
          encoder_hidden_states=encoder_outputs,
      )
      predicting_streams = decoder_outputs[1].view(
          1, model.config.ngram, 14, -1
      )
      predicting_streams_logits = model.lm_head(predicting_streams)
      next_first_stream_logits = predicting_streams_logits[:, 0]
      self.assertTrue(
          torch.allclose(
              next_first_stream_logits[:, :3, :3],
              expected_slice,
              atol=1e-4,
          )
      )
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/tests/models/xlm_prophetnet/test_modeling_xlm_prophetnet.py
imports: import unittest
  from transformers import is_torch_available
  from transformers.testing_utils import require_torch, slow, torch_device
label_desc: Use image node_id 1 for calling the XLMProphetNetModelIntegrationTest obj's underlying member method code with example usage: obj.test_pretrained_checkpoint_hidden_states() without return types